4 * Created on: Feb 4, 2015
8 #ifndef MODULEBASE_ACTIONINFO_H_
9 #define MODULEBASE_ACTIONINFO_H_
11 #include <ModuleBase.h>
12 #include <Config_FeatureMessage.h>
16 #include <QKeySequence>
22 * Structure to pass info about QActions, AppElements_Commands, etc.
24 struct MODULEBASE_EXPORT ModuleBase_ActionInfo
26 QString id; //!< action's (command) id
27 bool checkable; //!< action's checkable state
28 bool checked; //!< action's checked state
29 bool enabled; //!< action's enabled state
30 bool visible; //!< action's visibility state
31 QIcon icon; //!< action's icon
32 QString text; //!< action's text
33 QString iconText; //!< action's descriptive icon text
34 QString iconFile; //!< path to icon's file. Can not be initialized from QAction
35 QString toolTip; //!< action's tooltip
38 QKeySequence shortcut; //!< action's primary shortcut key
39 QFont font; //!< action's text font
42 //! Default constructor, \sa initDefault
43 ModuleBase_ActionInfo();
44 //! Initializes structure with default values, except text
45 ModuleBase_ActionInfo(const QString &text);
46 //! Initializes structure with default values, except icon and text
47 ModuleBase_ActionInfo(const QIcon &icon, const QString &text);
48 virtual ~ModuleBase_ActionInfo();
50 //! Fills itself with info from given \param theAction
51 void initFrom(QAction* theAction);
52 //! Fills itself with info from given \param theFeatureMessage
53 void initFrom(std::shared_ptr<Config_FeatureMessage> theFeatureMessage);
54 //! Creates new QAction with given parent and data initialized from this structure
55 //! \param theParent - parent of created action
56 QAction* makeAction(QObject* theParent = 0);
59 //! Initializes structure with default values, like QAction()
63 typedef ModuleBase_ActionInfo ActionInfo;
65 #endif /* XGUI_ACTIONINFO_H_ */