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
42
pglab/plugin_support/LWidgetAction.h
Normal file
42
pglab/plugin_support/LWidgetAction.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef LWIDGETACTION_H
|
||||
#define LWIDGETACTION_H
|
||||
|
||||
#include "MenuLocation.h"
|
||||
#include <QIcon>
|
||||
#include <QKeySequence>
|
||||
#include <QString>
|
||||
|
||||
|
||||
/** Action definition for a specific widget instance, it uses a slotname
|
||||
* so the action can be defined before the widget instance is created.
|
||||
* The plugin mechanism will take care of instantiating a connection to the named slot.
|
||||
*/
|
||||
class LWidgetAction {
|
||||
public:
|
||||
///
|
||||
/// \param slotname, use SLOT macro to pass name of the slot
|
||||
LWidgetAction(QString text, const char * slotname);
|
||||
|
||||
const QIcon& icon() const;
|
||||
const MenuLocation& menuLocation() const;
|
||||
void setIcon(QIcon icon);
|
||||
void setMenuLocation(MenuLocation menu_location);
|
||||
void setShortcut(QKeySequence shortcut);
|
||||
void setText(QString text);
|
||||
void setToolTip(QString tooltip);
|
||||
const QKeySequence& shortcut() const;
|
||||
const char* slotName() const { return m_slotname; }
|
||||
const QString& text() const;
|
||||
const QString& toolTip() const;
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
QString m_toolTip;
|
||||
QIcon m_icon;
|
||||
QKeySequence m_shortCut;
|
||||
MenuLocation m_menuLocation;
|
||||
|
||||
const char * m_slotname;
|
||||
};
|
||||
|
||||
#endif // LWIDGETACTION_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue