LibrePCB Developers Documentation
ExclusiveActionGroup Class Referencefinal

The ExclusiveActionGroup class groups multiple QAction's together. More...

#include <exclusiveactiongroup.h>

Inherits QObject.

+ Collaboration diagram for ExclusiveActionGroup:

Signals

void changeRequestTriggered (const QVariant &key)
 

Public Member Functions

 ExclusiveActionGroup () noexcept
 
 ExclusiveActionGroup (const ExclusiveActionGroup &other)=delete
 
 ~ExclusiveActionGroup () noexcept
 
void reset () noexcept
 
void setEnabled (bool enabled) noexcept
 
void addAction (const QVariant &key, QAction *action) noexcept
 
void setActionEnabled (const QVariant &key, bool enabled) noexcept
 
void setCurrentAction (const QVariant &key) noexcept
 
const QVariant & getCurrentAction () const noexcept
 
ExclusiveActionGroupoperator= (const ExclusiveActionGroup &rhs)=delete
 

Private Member Functions

void actionTriggered () noexcept
 

Private Attributes

QVariant mCurrentAction
 
QMap< QVariant, QAction * > mActions
 

Detailed Description

The ExclusiveActionGroup class groups multiple QAction's together.

This class is basically the same as QActionGroup (http://doc.qt.io/qt-5/qactiongroup.html). But there is one important difference: When the user clicks on a QAction, that action won't be checked instantly. Instead, this class only emits the signal changeRequestTriggered(). Whether the triggered action actually gets checked or the request is rejected can be decided from outside this class (typically by the state machine of an editor window). To change the selected action, setCurrentAction() needs to be called.

Constructor & Destructor Documentation

◆ ExclusiveActionGroup() [1/2]

ExclusiveActionGroup ( )
noexcept

◆ ExclusiveActionGroup() [2/2]

ExclusiveActionGroup ( const ExclusiveActionGroup other)
delete

◆ ~ExclusiveActionGroup()

~ExclusiveActionGroup ( )
noexcept

Member Function Documentation

◆ reset()

void reset ( )
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEnabled()

void setEnabled ( bool  enabled)
noexcept
+ Here is the caller graph for this function:

◆ addAction()

void addAction ( const QVariant &  key,
QAction *  action 
)
noexcept
+ Here is the call graph for this function:

◆ setActionEnabled()

void setActionEnabled ( const QVariant &  key,
bool  enabled 
)
noexcept
+ Here is the caller graph for this function:

◆ setCurrentAction()

void setCurrentAction ( const QVariant &  key)
noexcept
+ Here is the caller graph for this function:

◆ getCurrentAction()

const QVariant& getCurrentAction ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ operator=()

ExclusiveActionGroup& operator= ( const ExclusiveActionGroup rhs)
delete
+ Here is the caller graph for this function:

◆ changeRequestTriggered

void changeRequestTriggered ( const QVariant &  key)
signal
+ Here is the caller graph for this function:

◆ actionTriggered()

void actionTriggered ( )
privatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mCurrentAction

QVariant mCurrentAction
private

◆ mActions

QMap<QVariant, QAction*> mActions
private

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