pgLab/pglab/plugin_support/LWidgetAction.h
eelke f4f2474a81 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.
2019-01-05 19:58:23 +01:00

42 lines
1.1 KiB
C++

#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