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

Similar to WSettingAction, this can handle a multi-option setting as QMenu. More...

#include <WSettingMenu.h>

+ Inheritance diagram for WSettingMenu:
+ Collaboration diagram for WSettingMenu:

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

Detailed Description

Similar to WSettingAction, this can handle a multi-option setting as QMenu.

Definition at line 35 of file WSettingMenu.h.

Constructor & Destructor Documentation

◆ WSettingMenu()

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.

Parameters
parentthe parent widget owning this menu
settingNamethe name of the setting tohandle
menuNamethe menu's name
tooltipthe tooltip for the menu
defaultValuea initial default item
optionsa list of exclusive options
showRestartInfoif 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.

+ Here is the call graph for this function:

◆ ~WSettingMenu()

WSettingMenu::~WSettingMenu ( )
virtual

Destructor.

Definition at line 69 of file WSettingMenu.cpp.

Member Function Documentation

◆ change

void WSettingMenu::change ( unsigned int  index)
signal

Signal getting emitted if the selected option changes.

Parameters
indexthe new index.

Referenced by handleUpdate().

+ Here is the caller graph for this function:

◆ get()

unsigned int WSettingMenu::get ( ) const

Returns the current setting.

Returns
current setting

Definition at line 88 of file WSettingMenu.cpp.

References m_currentItem.

Referenced by WQtToolBarBase::WQtToolBarBase().

+ Here is the caller graph for this function:

◆ handleUpdate

void WSettingMenu::handleUpdate ( QAction action)
privateslot

Handles updates in the option.

Parameters
actionthe 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().

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

Member Data Documentation

◆ m_currentItem

unsigned int WSettingMenu::m_currentItem
private

Tracks the currently selected option.

Definition at line 89 of file WSettingMenu.h.

Referenced by get(), handleUpdate(), and WSettingMenu().

◆ m_settingName

QString WSettingMenu::m_settingName
private

The name of the setting handled here.

Definition at line 79 of file WSettingMenu.h.

Referenced by handleUpdate(), and WSettingMenu().

◆ m_showRestartInfo

bool WSettingMenu::m_showRestartInfo
private

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

Definition at line 84 of file WSettingMenu.h.

Referenced by handleUpdate().


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