Public Types | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
pqModalShortcut Class Reference

Manage an action and/or widget's responsivity to a shortcut. More...

#include <pqModalShortcut.h>

Inherits QObject.

Public Types

using Superclass = QObject
 

Signals

void enabled ()
 Called from setEnabled() whenever it is passed true. More...
 
void disabled ()
 Called from setEnabled() whenever it is passed false. More...
 
void unregister ()
 Called from the destructor. More...
 
void activated ()
 Invoked when the key sequence is pressed. More...
 

Public Member Functions

 ~pqModalShortcut () override
 
void setContextWidget (QWidget *contextWidget, Qt::ShortcutContext contextArea=Qt::WindowShortcut)
 If the shortcut should be restricted to a particular widget (such as a pqView), use this method to set and update the widget during the life of the pqModalShortcut. More...
 
bool isEnabled () const
 
void setEnabled (bool shouldEnable, bool changeFocus=true)
 
QKeySequence keySequence () const
 

Protected Member Functions

 pqModalShortcut (const QKeySequence &key, QAction *action=nullptr, QWidget *parent=nullptr)
 

Protected Attributes

QKeySequence m_key
 
QPointer< QShortcut > m_shortcut
 
QPointer< QAction > m_action
 

Friends

class pqKeySequences
 

Detailed Description

Manage an action and/or widget's responsivity to a shortcut.

This object will add and remove a connection between a widget/action and a QShortcut as required by the pqKeySequences manager to prevent any ambiguous activations.

Definition at line 21 of file pqModalShortcut.h.

Member Typedef Documentation

◆ Superclass

using pqModalShortcut::Superclass = QObject

Definition at line 26 of file pqModalShortcut.h.

Constructor & Destructor Documentation

◆ ~pqModalShortcut()

pqModalShortcut::~pqModalShortcut ( )
override

◆ pqModalShortcut()

pqModalShortcut::pqModalShortcut ( const QKeySequence &  key,
QAction *  action = nullptr,
QWidget *  parent = nullptr 
)
protected

Member Function Documentation

◆ setContextWidget()

void pqModalShortcut::setContextWidget ( QWidget *  contextWidget,
Qt::ShortcutContext  contextArea = Qt::WindowShortcut 
)

If the shortcut should be restricted to a particular widget (such as a pqView), use this method to set and update the widget during the life of the pqModalShortcut.

◆ isEnabled()

bool pqModalShortcut::isEnabled ( ) const

◆ setEnabled()

void pqModalShortcut::setEnabled ( bool  shouldEnable,
bool  changeFocus = true 
)

◆ keySequence()

QKeySequence pqModalShortcut::keySequence ( ) const

◆ enabled

void pqModalShortcut::enabled ( )
signal

Called from setEnabled() whenever it is passed true.

This is used by pqKeySequences to disable any sibling shortcuts with the same keysequence.

This may also be used by widgets to update their visual state, indicating they are now accepting shortcuts.

◆ disabled

void pqModalShortcut::disabled ( )
signal

Called from setEnabled() whenever it is passed false.

This may be used by widgets to update their visual state, indicating they are no longer accepting shortcuts.

◆ unregister

void pqModalShortcut::unregister ( )
signal

Called from the destructor.

This is used by pqKeySequences to clean its records.

◆ activated

void pqModalShortcut::activated ( )
signal

Invoked when the key sequence is pressed.

Friends And Related Function Documentation

◆ pqKeySequences

friend class pqKeySequences
friend

Definition at line 65 of file pqModalShortcut.h.

Member Data Documentation

◆ m_key

QKeySequence pqModalShortcut::m_key
protected

Definition at line 68 of file pqModalShortcut.h.

◆ m_shortcut

QPointer<QShortcut> pqModalShortcut::m_shortcut
protected

Definition at line 69 of file pqModalShortcut.h.

◆ m_action

QPointer<QAction> pqModalShortcut::m_action
protected

Definition at line 70 of file pqModalShortcut.h.


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