ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvKeySequences Class Reference

Manage key sequences used for shortcuts. More...

#include <ecvKeySequences.h>

Inheritance diagram for ecvKeySequences:
[legend]
Collaboration diagram for ecvKeySequences:
[legend]

Public Member Functions

ecvModalShortcut * active (const QKeySequence &keySequence) const
 
ecvModalShortcut * addModalShortcut (const QKeySequence &keySequence, QAction *action, QWidget *parent)
 
void reorder (ecvModalShortcut *target)
 
void dumpShortcuts (const QKeySequence &keySequence) const
 

Static Public Member Functions

static ecvKeySequences & instance ()
 

Protected Slots

virtual void disableSiblings ()
 
virtual void enableNextSibling ()
 
virtual void removeModalShortcut ()
 

Protected Member Functions

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

Protected Attributes

bool m_silence
 Set true in slot implementations to avoid signal/slot recursion. More...
 

Detailed Description

Manage key sequences used for shortcuts.

ParaView-style modal shortcut manager that prevents ambiguous activation by ensuring only one listener is active for each key sequence at a time.

Key features:

  • Automatic mutual exclusion: when one shortcut is enabled, all siblings are disabled
  • Visual feedback: widgets can show which one currently owns a shortcut
  • Context awareness: shortcuts can be limited to specific widgets

Usage:

QKeySequence(Qt::Key_S), myAction, myWidget);

Constructor & Destructor Documentation

◆ ecvKeySequences()

ecvKeySequences::ecvKeySequences ( QObject *  parent)
protected

References CVLog::PrintVerbose().

◆ ~ecvKeySequences()

ecvKeySequences::~ecvKeySequences ( )
overrideprotecteddefault

Member Function Documentation

◆ active()

ecvModalShortcut * ecvKeySequences::active ( const QKeySequence &  keySequence) const

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

◆ addModalShortcut()

ecvModalShortcut * ecvKeySequences::addModalShortcut ( const QKeySequence &  keySequence,
QAction *  action,
QWidget *  parent 
)

Register a modal shortcut with the manager.

Parameters
keySequenceThe key combination to listen for
actionThe action to trigger (optional)
parentThe context widget (optional)
Returns
The created modal shortcut (owned by the manager)

References disableSiblings(), ecvModalShortcut::enabled(), CVLog::PrintVerbose(), removeModalShortcut(), ecvModalShortcut::unregister(), and CVLog::Warning().

Referenced by cvPointPickingHelper::cvPointPickingHelper().

◆ disableSiblings

void ecvKeySequences::disableSiblings ( )
protectedvirtualslot

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

References m_silence, and CVLog::PrintVerbose().

Referenced by addModalShortcut().

◆ dumpShortcuts()

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

Dump a list of shortcuts registered for a given key sequence (debug).

References CVLog::Print(), and CVLog::PrintVerbose().

◆ enableNextSibling

void ecvKeySequences::enableNextSibling ( )
protectedvirtualslot

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

References m_silence, and CVLog::PrintVerbose().

◆ instance()

ecvKeySequences & ecvKeySequences::instance ( )
static

◆ removeModalShortcut

void ecvKeySequences::removeModalShortcut ( )
protectedvirtualslot

Called when shortcuts are deleted to disable and unregister them.

References CVLog::PrintVerbose().

Referenced by addModalShortcut().

◆ reorder()

void ecvKeySequences::reorder ( ecvModalShortcut *  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 ecvModalShortcut::setEnabled in response to user input.

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

References ecvModalShortcut::isEnabled(), ecvModalShortcut::keySequence(), and CVLog::PrintVerbose().

Referenced by ecvShortcutDecorator::eventFilter().

Member Data Documentation

◆ m_silence

bool ecvKeySequences::m_silence
protected

Set true in slot implementations to avoid signal/slot recursion.

Referenced by disableSiblings(), and enableNextSibling().


The documentation for this class was generated from the following files:
ecvKeySequences::instance
static ecvKeySequences & instance()
Definition: ecvKeySequences.cpp:52
ecvKeySequences::addModalShortcut
ecvModalShortcut * addModalShortcut(const QKeySequence &keySequence, QAction *action, QWidget *parent)
Definition: ecvKeySequences.cpp:83