OpenWalnut
1.5.0dev
|
Similar to WSettingAction, this can handle a multi-option setting as QMenu. More...
#include <WSettingMenu.h>
Signals | |
void | change (unsigned int index) |
Signal getting emitted if the selected option changes. More... | |
Public Member Functions | |
WSettingMenu (QWidget *parent, std::string settingName, std::string menuName, std::string tooltip, unsigned int defaultValue, const QList< QString > &options, bool showRestartInfo=false) | |
Constructs a menu with the specified options and automatically handles updates. More... | |
virtual | ~WSettingMenu () |
Destructor. More... | |
unsigned int | get () const |
Returns the current setting. More... | |
Private Slots | |
void | handleUpdate (QAction *action) |
Handles updates in the option. More... | |
Private Attributes | |
QString | m_settingName |
The name of the setting handled here. More... | |
bool | m_showRestartInfo |
If true, a change of the setting causes an restart notification dialog. More... | |
unsigned int | m_currentItem |
Tracks the currently selected option. More... | |
Similar to WSettingAction, this can handle a multi-option setting as QMenu.
Definition at line 35 of file WSettingMenu.h.
WSettingMenu::WSettingMenu | ( | QWidget * | parent, |
std::string | settingName, | ||
std::string | menuName, | ||
std::string | tooltip, | ||
unsigned int | defaultValue, | ||
const QList< QString > & | options, | ||
bool | showRestartInfo = false |
||
) |
Constructs a menu with the specified options and automatically handles updates.
parent | the parent widget owning this menu |
settingName | the name of the setting tohandle |
menuName | the menu's name |
tooltip | the tooltip for the menu |
defaultValue | a initial default item |
options | a list of exclusive options |
showRestartInfo | if true, show an info dialog that changes get applied on next start. |
Definition at line 33 of file WSettingMenu.cpp.
References WQtGui::getSettings(), handleUpdate(), m_currentItem, and m_settingName.
|
virtual |
Destructor.
Definition at line 69 of file WSettingMenu.cpp.
|
signal |
Signal getting emitted if the selected option changes.
index | the new index. |
Referenced by handleUpdate().
unsigned int WSettingMenu::get | ( | ) | const |
Returns the current setting.
Definition at line 88 of file WSettingMenu.cpp.
References m_currentItem.
Referenced by WQtToolBarBase::WQtToolBarBase().
|
privateslot |
Handles updates in the option.
action | the triggered action. |
Definition at line 73 of file WSettingMenu.cpp.
References change(), WQtGui::getMainWindow(), WQtGui::getSettings(), m_currentItem, m_settingName, and m_showRestartInfo.
Referenced by WSettingMenu().
|
private |
Tracks the currently selected option.
Definition at line 89 of file WSettingMenu.h.
Referenced by get(), handleUpdate(), and WSettingMenu().
|
private |
The name of the setting handled here.
Definition at line 79 of file WSettingMenu.h.
Referenced by handleUpdate(), and WSettingMenu().
|
private |
If true, a change of the setting causes an restart notification dialog.
Definition at line 84 of file WSettingMenu.h.
Referenced by handleUpdate().