OpenWalnut  1.5.0dev
Signals | Public Member Functions | Private Slots | Private Attributes | List of all members
WSettingAction Class Reference

Class to handle a certain setting with an action. More...

#include <WSettingAction.h>

+ Inheritance diagram for WSettingAction:
+ Collaboration diagram for WSettingAction:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ WSettingAction()

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.

Parameters
parentthe parent handling this
settingNamethe name of the setting to handle
actionNamethe name of the action
defaultValuethe default if setting not existing
tooltipthe tooltip text
showRestartInfoif true, info dialog is shown which says that a restart is needed
shortcutthe shortcut keysequence

Definition at line 30 of file WSettingAction.cpp.

References WQtGui::getSettings(), and stateChange().

+ Here is the call graph for this function:

◆ ~WSettingAction()

WSettingAction::~WSettingAction ( )
virtual

Destructor.

Definition at line 53 of file WSettingAction.cpp.

Member Function Documentation

◆ change

void WSettingAction::change ( bool  value)
signal

This signal is emitted if this setting changes.

Parameters
valuethe new setting value.

Referenced by stateChange().

+ Here is the caller graph for this function:

◆ get()

bool WSettingAction::get ( ) const

Gets the current state.

Returns
state

Definition at line 57 of file WSettingAction.cpp.

Referenced by WMainWindow::setupGUI().

+ Here is the caller graph for this function:

◆ stateChange

void WSettingAction::stateChange ( bool  state)
privateslot

The state has changed by the action.

Handled here.

Parameters
statethe state

Definition at line 62 of file WSettingAction.cpp.

References change(), WQtGui::getMainWindow(), WQtGui::getSettings(), m_settingName, and m_showRestartInfo.

Referenced by WSettingAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_settingName

QString WSettingAction::m_settingName
private

The name of the setting handled here.

Definition at line 93 of file WSettingAction.h.

Referenced by stateChange().

◆ m_showRestartInfo

bool WSettingAction::m_showRestartInfo
private

If true, a change of the setting causes an restart notification dialog.

Definition at line 98 of file WSettingAction.h.

Referenced by stateChange().


The documentation for this class was generated from the following files: