![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/PopupMenuButton.h>
Extension of a QToolButton to which you can add a drop-down menu. More...
Inheritance diagram for PopupMenuButton:Extension of a QToolButton to which you can add a drop-down menu.
This is a mixture of a combo box and a button on a single widget. When toggling the drop down menu the user can select one of the available menu entries, which is executed directly. Furthermore, the widget saves the last selected entry and will show this as default action, which is executed when clicking on the main part of the button.
To the outside, menu entries (actions) are identified by a simple string. There is no duplicate detection of action IDs implemented in this class.
Signals | |
| void | actionTriggered (QString actionId) |
| Signal emitted every time button is clicked or one of the menu entries is selected. | |
Public Member Functions | |
| PopupMenuButton (const QString &storageId, QWidget *parent=nullptr) | |
| Creates a new PopupMenuButton using the. | |
| ~PopupMenuButton () override | |
| Default destructor. | |
| void | addAction (const QString &title, const QString &actionId, bool setAsDefaultAction=false) |
| Add an action to the drop down menu of this button. | |
| void | setActionEnabled (const QString &actionId, bool enabledState) |
| Sets the enabled state of the given action. | |
| const QString & | currentActionId () const |
| Return the ID of the currently selected default action. | |
Protected Slots | |
| virtual void | onAction (bool) |
Protected Member Functions | |
| void | storeDefault (const QString &id) |
| QString | retrieveDefault () const |
Protected Attributes | |
| QMenu * | m_menu |
| std::map< QAction *, QString > | m_actions |
| QString | m_storageId |
| QString | m_currentActionId |
| PopupMenuButton | ( | const QString & | storageId, |
| QWidget * | parent = nullptr ) |
Creates a new PopupMenuButton using the.
| storageId | String to use as key for storing the default action in QSettings If storageId is empty, the selected default action will not be written to QSettings. |
| parent | Parent widget |
| void addAction | ( | const QString & | title, |
| const QString & | actionId, | ||
| bool | setAsDefaultAction = false ) |
Add an action to the drop down menu of this button.
| title | Text that is shown in the menu for this item. |
| actionId | String ID to reference this action. |
| setAsDefaultAction | Flag whether to use this action as default entry. |
| void setActionEnabled | ( | const QString & | actionId, |
| bool | enabledState ) |
Sets the enabled state of the given action.
| actionId | String ID of the action to modify |
| enabledState | Enabled state of the corresponding action |
|
signal |
Signal emitted every time button is clicked or one of the menu entries is selected.
| actionId | String ID of the selected action as provided in addAction(). |