The plugin system will create the Action objects and bind them to the specified slots of the specific widget instances.
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#ifndef PLUGINCONTENTWIDGETCONTEXTBASE_H
|
|
#define PLUGINCONTENTWIDGETCONTEXTBASE_H
|
|
|
|
#include "plugin_support/IPluginContentWidgetContext.h"
|
|
#include <QList>
|
|
|
|
class LWidgetAction;
|
|
class QToolBar;
|
|
class QAction;
|
|
|
|
class LWidgetData {
|
|
public:
|
|
LWidgetData(PluginModule *module);
|
|
PluginModule* module() { return m_module; }
|
|
void init(PluginContentWidget *widget);
|
|
QList<QAction *> actions();
|
|
|
|
private:
|
|
PluginModule *m_module;
|
|
/// List of actions specifically created for this widget from the widgetAction list of the module.
|
|
QList<QAction *> m_widgetActions;
|
|
|
|
QAction *createAction(const LWidgetAction &wa, PluginContentWidget *widget);
|
|
};
|
|
|
|
/// Provides base implementation of IPluginContentWidgetContext
|
|
class PluginContentWidgetContextBase : public IPluginContentWidgetContext
|
|
{
|
|
public:
|
|
PluginContentWidgetContextBase();
|
|
|
|
void moduleAction(
|
|
const QString &module_identifier,
|
|
QString module_action,
|
|
const ModuleActionParameters &action_params
|
|
) override;
|
|
|
|
void addContentWidget(PluginModule *module, PluginContentWidget *widget) override;
|
|
void removeContentWidget(PluginContentWidget *widget) override;
|
|
|
|
void addWidgetActionsToToolbar(PluginContentWidget *widget, QToolBar *toolbar);
|
|
void removeWidgetActionsFromToolbar(PluginContentWidget *widget, QToolBar *toolbar);
|
|
private:
|
|
|
|
using WidgetLst = std::map<PluginContentWidget*, LWidgetData>;
|
|
|
|
WidgetLst m_widgetLst;
|
|
};
|
|
|
|
#endif // PLUGINCONTENTWIDGETCONTEXTBASE_H
|