LibrePCB Developers Documentation
Loading...
Searching...
No Matches
ExclusiveActionGroup Class Referencefinal

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

#include <exclusiveactiongroup.h>

Inherits QObject.

+ Collaboration diagram for ExclusiveActionGroup:

Signals

void actionTriggered (int id, const QVariant &mode)
 

Public Member Functions

 ExclusiveActionGroup () noexcept
 
 ExclusiveActionGroup (const ExclusiveActionGroup &other)=delete
 
 ~ExclusiveActionGroup () noexcept
 
void reset () noexcept
 
void setEnabled (bool enabled) noexcept
 
void addAction (QPointer< QAction > action, int id, const QVariant &mode=QVariant()) noexcept
 
void setActionEnabled (int id, bool enabled) noexcept
 
void setCurrentAction (int id) noexcept
 
ExclusiveActionGroupoperator= (const ExclusiveActionGroup &rhs)=delete
 

Private Member Functions

void actionTriggeredSlot () noexcept
 

Private Attributes

QHash< int, QVector< std::pair< QPointer< QAction >, QVariant > > > 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 actionTriggered(). 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.

In addition, this class provides support for "nested" actions, used to create tools which can be entered in different modes.

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 ( QPointer< QAction >  action,
int  id,
const QVariant &  mode = QVariant() 
)
noexcept
+ Here is the call graph for this function:

◆ setActionEnabled()

void setActionEnabled ( int  id,
bool  enabled 
)
noexcept

◆ setCurrentAction()

void setCurrentAction ( int  id)
noexcept
+ Here is the caller graph for this function:

◆ operator=()

ExclusiveActionGroup & operator= ( const ExclusiveActionGroup rhs)
delete

◆ actionTriggered

void actionTriggered ( int  id,
const QVariant &  mode 
)
signal
+ Here is the caller graph for this function:

◆ actionTriggeredSlot()

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

Member Data Documentation

◆ mActions

QHash<int, QVector<std::pair<QPointer<QAction>, QVariant> > > mActions
private

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