*/
struct MODULEBASE_EXPORT ModuleBase_ActionInfo
{
- QString id;
-
+ QString id; //!< action's (command) id
bool checkable; //!< action's checkable state
bool checked; //!< action's checked state
bool enabled; //!< action's enabled state
const QKeySequence& theKeys = QKeySequence(),
bool isCheckable = false);
+ //! Add feature (QAction) in the \a theWBName toolbar with given \a theInfo about action
virtual QAction* addFeature(const QString& theWBName,
- const ActionInfo& theInfo);
-
+ const ActionInfo& theInfo);
virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
const QString& theTip, const QIcon& theIcon,
XGUI_ActionsMgr(XGUI_Workshop* theWorkshop);
virtual ~XGUI_ActionsMgr();
+ /// Actions on operations
enum OperationStateActionId {
Abort = 0,
Accept = 1,
//! If there is no such action, it will be created.
QAction* operationStateAction(OperationStateActionId theId, QObject* theParent = 0);
+ /// Return info (icon, text, etc) about the action by the given id, if it was registered in the manager
ActionInfo actionInfoById(const QString& theId);
public slots:
#include <QToolButton>
#include <QAction>
-//! Extends given feature with previously created context menu.
-//! \param theId - Id of the feature to add \a theMenu
-//! \param theMenu - Enables or disables menu feature
XGUI_HistoryMenu::XGUI_HistoryMenu(QAction* theParent)
: QMenu(NULL),
myHistoryList(NULL)
connect(theParent, SIGNAL(destroyed()), this, SLOT(deleteLater()));
}
-//! Extends given feature with previously created context menu.
-//! \param theId - Id of the feature to add \a theMenu
-//! \param theMenu - Enables or disables menu feature
XGUI_HistoryMenu::XGUI_HistoryMenu(QToolButton* theParent)
: QMenu(theParent),
myHistoryList(NULL)
class QToolButton;
class QListWidgetItem;
+/**
+ * \class XGUI_HistoryMenu
+ * \ingroup GUI
+ * \brief Extends regular QToolButton of QAction with HistoryMenu (stack of actions)
+ */
class XGUI_EXPORT XGUI_HistoryMenu : public QMenu
{
Q_OBJECT
public:
+ /// Creates history menu for button
explicit XGUI_HistoryMenu(QToolButton* theParent);
+ /// Creates history menu for action
explicit XGUI_HistoryMenu(QAction* theParent);
virtual ~XGUI_HistoryMenu();
signals:
+ /// Signal. Emited then n-th action is selected in stack
void actionSelected(int);
public slots:
+ /// Set list of actions
void setHistory(const QList<ActionInfo>&);
protected:
+ /// Unselects all items when cursor leaves the list
virtual void leaveEvent(QEvent *);
protected slots:
+ /// Selects all items in stack to the given item including it
void setStackSelectedTo(QListWidgetItem *);
+ /// Emits actionSelected() signal.
void onItemPressed(QListWidgetItem *);
+ /// Initializes internal controls of the Menu
void initMenu();
-
private:
- QListWidget* myHistoryList;
+ QListWidget* myHistoryList; ///< List to contain actions
};
#endif /* XGUI_OPERATIONSSTACKPOPUP_H_ */
const QString& theTitle, const QString& theTip, const QIcon& theIcon,
const QKeySequence& theKeys, bool isCheckable) = 0;
+ //! Creates a feature (command) in SALOME desktop
+ //! \param theWBName - name of toolbar (workbench)
+ //! \param theInfo - information about action (icon, text, etc)
virtual QAction* addFeature(const QString& theWBName,
const ActionInfo& theInfo) = 0;
//! the application is started
void applicationStarted();
+ //! Signal to update Undo history list
void updateUndoHistory(const QList<ActionInfo>&);
+ //! Signal to update Redo history list
void updateRedoHistory(const QList<ActionInfo>&);
public slots: