OpenWalnut
1.5.0dev
|
Class to handle a certain setting with an action. More...
#include <WSettingAction.h>
Signals | |
void | change (bool value) |
This signal is emitted if this setting changes. More... | |
Public Member Functions | |
WSettingAction (QObject *parent, std::string settingName, std::string actionName, std::string tooltip, bool defaultValue, bool showRestartInfo=false, const QKeySequence &shortcut=0) | |
Constructs an action which handles a certain setting. More... | |
virtual | ~WSettingAction () |
Destructor. More... | |
bool | get () const |
Gets the current state. More... | |
Private Slots | |
void | stateChange (bool state) |
The state has changed by the action. 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... | |
Class to handle a certain setting with an action.
The action is associated with a QSettings value. Please note, that this class is not able to handle async changes in the QSettings object. So, try to avoid multiple actions for one setting.
Definition at line 48 of file WSettingAction.h.
WSettingAction::WSettingAction | ( | QObject * | parent, |
std::string | settingName, | ||
std::string | actionName, | ||
std::string | tooltip, | ||
bool | defaultValue, | ||
bool | showRestartInfo = false , |
||
const QKeySequence & | shortcut = 0 |
||
) |
Constructs an action which handles a certain setting.
parent | the parent handling this |
settingName | the name of the setting to handle |
actionName | the name of the action |
defaultValue | the default if setting not existing |
tooltip | the tooltip text |
showRestartInfo | if true, info dialog is shown which says that a restart is needed |
shortcut | the shortcut keysequence |
Definition at line 30 of file WSettingAction.cpp.
References WQtGui::getSettings(), and stateChange().
|
virtual |
Destructor.
Definition at line 53 of file WSettingAction.cpp.
|
signal |
This signal is emitted if this setting changes.
value | the new setting value. |
Referenced by stateChange().
bool WSettingAction::get | ( | ) | const |
Gets the current state.
Definition at line 57 of file WSettingAction.cpp.
Referenced by WMainWindow::setupGUI().
|
privateslot |
The state has changed by the action.
Handled here.
state | the state |
Definition at line 62 of file WSettingAction.cpp.
References change(), WQtGui::getMainWindow(), WQtGui::getSettings(), m_settingName, and m_showRestartInfo.
Referenced by WSettingAction().
|
private |
The name of the setting handled here.
Definition at line 93 of file WSettingAction.h.
Referenced by stateChange().
|
private |
If true, a change of the setting causes an restart notification dialog.
Definition at line 98 of file WSettingAction.h.
Referenced by stateChange().