![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GUI/CoreWidgets/ButtonDropdownWidget.h>
Push button and a dropdown menu together as a single widget. More...
Inheritance diagram for ButtonDropdownWidget:Push button and a dropdown menu together as a single widget.
This widget supports three operation modes In FixedButton mode, when a menu entry is selected, the main button will not change
In UpdateButton mode, when a menu entry is selected, the main button will change to the selected entry.
In PersistentUpdateButton mode, when a menu entry is selected, the main button will change to the selected entry. The main button will keep this value between restarts. For this mode, the storageId has to be set to a unique value.
Examples:
auto fixedWidget = new ButtonDropdownWidget(fixedButtonAction, parent);
fixedWidget->addActions({menu0Action,menu1Action,menu2Action});
auto updateWidget = new ButtonDropdownWidget(updateButtonAction, parent, ButtonDropdownWidget::Mode::UpdateButton);
updateWidget->addActions({menu0Action,menu1Action,menu2Action});
auto persistWidget = new ButtonDropdownWidget(persistButtonAction, parent, ButtonDropdownWidget::Mode::PersistentUpdateButton, "persist");
persistWidget->addActions({menu0Action,menu1Action,menu2Action});
Public Types | |
| enum class | Mode { FixedButton , UpdateButton , PersistentUpdateButton } |
Public Member Functions | |
| ButtonDropdownWidget (QAction *button, QWidget *parent=nullptr, Mode mode=Mode::FixedButton, const QString &storageId="") | |
| Creates a push button and a dropdown menu. | |
| bool | addAction (QAction *action) |
| Adds an action to the dropdown menu. | |
| bool | addActions (const QList< QAction * > &actions) |
|
strong |
|
explicit |
Creates a push button and a dropdown menu.
Can choose if the main button is updated when selecting, and if storageId is provided, it will store the latest selection
| bool addAction | ( | QAction * | action | ) |
Adds an action to the dropdown menu.
If storage is used and matches the action, it will be set in the button. Returns true if action was added correctly, returns false if action with same text already exists