Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
pqKeySequences Class Reference

Manage key sequences used for shortcuts. More...

#include <pqKeySequences.h>

Inherits QObject.

Public Member Functions

pqModalShortcutactive (const QKeySequence &keySequence) const
 Return the active shortcut for a given key sequence (if any). More...
 
pqModalShortcutaddModalShortcut (const QKeySequence &keySequence, QAction *action, QWidget *parent)
 Inform the manager of an action (and paired parent) that should be activated for the keySequence. More...
 
void reorder (pqModalShortcut *target)
 Ask the manager to reorder shortcuts so that the currently-active one becomes the "next" in line to the passed target. More...
 
void dumpShortcuts (const QKeySequence &keySequence) const
 Dump a list of shortcuts registered for a given key sequence. More...
 

Static Public Member Functions

static pqKeySequencesinstance ()
 

Protected Slots

virtual void disableSiblings ()
 Called when a shortcut is enabled to ensure siblings are disabled. More...
 
virtual void enableNextSibling ()
 Not currently used. More...
 
virtual void removeModalShortcut ()
 Called when shortcuts are deleted to disable and unregister them. More...
 

Protected Member Functions

 pqKeySequences (QObject *parent)
 
 ~pqKeySequences () override=default
 

Protected Attributes

bool m_silence
 

Detailed Description

Manage key sequences used for shortcuts.

Rather use Qt's approach for shortcuts (which deals with multiple listeners for the same key-sequence by notifying all of them of ambiguous activation), this class deactivates all but one listener so there can be no ambiguity. Listeners are expected to (1) signal when the user has requested they become the single active listener and (2) respond to activation/deactivation by updating their appearance so users can discern which listener will respond to a given key sequence.

Definition at line 25 of file pqKeySequences.h.

Constructor & Destructor Documentation

◆ pqKeySequences()

pqKeySequences::pqKeySequences ( QObject *  parent)
protected

◆ ~pqKeySequences()

pqKeySequences::~pqKeySequences ( )
overrideprotecteddefault

Member Function Documentation

◆ instance()

static pqKeySequences& pqKeySequences::instance ( )
static

◆ active()

pqModalShortcut* pqKeySequences::active ( const QKeySequence &  keySequence) const

Return the active shortcut for a given key sequence (if any).

◆ addModalShortcut()

pqModalShortcut* pqKeySequences::addModalShortcut ( const QKeySequence &  keySequence,
QAction *  action,
QWidget *  parent 
)

Inform the manager of an action (and paired parent) that should be activated for the keySequence.

◆ reorder()

void pqKeySequences::reorder ( pqModalShortcut target)

Ask the manager to reorder shortcuts so that the currently-active one becomes the "next" in line to the passed target.

** NB: This method is currently a placeholder. **

Widgets should call this method before invoking pqModalShortCut::setEnabled in response to user input.

This method has no effect if no sibling of target is active at the time it is invoked.

◆ dumpShortcuts()

void pqKeySequences::dumpShortcuts ( const QKeySequence &  keySequence) const

Dump a list of shortcuts registered for a given key sequence.

◆ disableSiblings

virtual void pqKeySequences::disableSiblings ( )
protectedvirtualslot

Called when a shortcut is enabled to ensure siblings are disabled.

◆ enableNextSibling

virtual void pqKeySequences::enableNextSibling ( )
protectedvirtualslot

Not currently used.

Intended for use enabling next-most-recently-used shortcut.

◆ removeModalShortcut

virtual void pqKeySequences::removeModalShortcut ( )
protectedvirtualslot

Called when shortcuts are deleted to disable and unregister them.

Member Data Documentation

◆ m_silence

bool pqKeySequences::m_silence
protected

Definition at line 80 of file pqKeySequences.h.


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