Manage key sequences used for shortcuts. More...
#include <pqKeySequences.h>
Inherits QObject.
Public Member Functions | |
pqModalShortcut * | active (const QKeySequence &keySequence) const |
Return the active shortcut for a given key sequence (if any). More... | |
pqModalShortcut * | addModalShortcut (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 pqKeySequences & | instance () |
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 |
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.
|
protected |
|
overrideprotecteddefault |
|
static |
pqModalShortcut* pqKeySequences::active | ( | const QKeySequence & | keySequence | ) | const |
Return the active shortcut for a given key sequence (if any).
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.
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.
void pqKeySequences::dumpShortcuts | ( | const QKeySequence & | keySequence | ) | const |
Dump a list of shortcuts registered for a given key sequence.
|
protectedvirtualslot |
Called when a shortcut is enabled to ensure siblings are disabled.
|
protectedvirtualslot |
Not currently used.
Intended for use enabling next-most-recently-used shortcut.
|
protectedvirtualslot |
Called when shortcuts are deleted to disable and unregister them.
|
protected |
Definition at line 80 of file pqKeySequences.h.