Moved definition of widget instance actions to the module so other parts of the system can no about them.
The plugin system will create the Action objects and bind them to the specified slots of the specific widget instances.
This commit is contained in:
parent
d0c4dabe8b
commit
f4f2474a81
21 changed files with 418 additions and 204 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "ModuleActionParameters.h"
|
||||
#include "MenuAction.h"
|
||||
#include "LWidgetAction.h"
|
||||
#include "PluginRegister.h"
|
||||
#include <QObject>
|
||||
#include <functional>
|
||||
|
|
@ -16,12 +17,13 @@ class PluginModule: public QObject {
|
|||
Q_OBJECT
|
||||
public:
|
||||
using MenuActionList = std::vector<MenuAction>;
|
||||
using LWidgetActionList = std::vector<LWidgetAction>;
|
||||
using ModuleAction = std::function<void(IPluginContentWidgetContext*, const ModuleActionParameters &)>;
|
||||
using ModuleActionMap = std::map<QString, ModuleAction>;
|
||||
|
||||
PluginModule(QString name, QString ident);
|
||||
|
||||
virtual void init() {};
|
||||
virtual void init() {}
|
||||
|
||||
const QString& name() const { return m_name; }
|
||||
const QString& identifier() const { return m_ident; }
|
||||
|
|
@ -38,6 +40,12 @@ public:
|
|||
/// Searches for and returns a pointer to the requested module action.
|
||||
/// When the action is not found nullptr is returned.
|
||||
const ModuleAction* findModuleAction(const QString &module_action) const;
|
||||
|
||||
void registerWidgetAction(const LWidgetAction &action)
|
||||
{
|
||||
m_widgetActions.push_back(action);
|
||||
}
|
||||
const LWidgetActionList& widgetActions() const { return m_widgetActions; }
|
||||
private:
|
||||
/// Name shown to end users
|
||||
QString m_name;
|
||||
|
|
@ -47,6 +55,7 @@ private:
|
|||
|
||||
MenuActionList m_menuActions;
|
||||
ModuleActionMap m_moduleActions;
|
||||
LWidgetActionList m_widgetActions;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue