Decorate a widget by highlighting its frame when keyboard shortcuts are active.
More...
#include <ecvShortcutDecorator.h>
|
| virtual void | setEnabled (bool enable, bool refocusWhenEnabling=false) |
| |
Decorate a widget by highlighting its frame when keyboard shortcuts are active.
This class provides visual feedback for widgets that have modal shortcuts attached. Features:
- Highlights the widget's border when shortcuts are active
- Allows users to click on the border to activate/deactivate shortcuts
- Monitors mouse enter/exit events for visual feedback
- Manages multiple shortcuts as a group (all enabled/disabled together)
Usage:
decorator->addShortcut(shortcut);
ecvModalShortcut * addModalShortcut(const QKeySequence &keySequence, QAction *action, QWidget *parent)
static ecvKeySequences & instance()
ecvShortcutDecorator(QFrame *parent)
Definition at line 41 of file ecvShortcutDecorator.h.
◆ Superclass
◆ ecvShortcutDecorator()
| ecvShortcutDecorator::ecvShortcutDecorator |
( |
QFrame * |
parent | ) |
|
|
explicit |
Create a decorator for the given widget.
- Parameters
-
| parent | The widget to decorate (must be a QFrame or subclass) |
◆ ~ecvShortcutDecorator()
| ecvShortcutDecorator::~ecvShortcutDecorator |
( |
| ) |
|
|
overridedefault |
◆ addShortcut()
Add a shortcut to this decorator. All shortcuts attached to a decorator are enabled/disabled as a group.
- Parameters
-
| shortcut | The modal shortcut to attach |
◆ decoratedFrame()
| QFrame* ecvShortcutDecorator::decoratedFrame |
( |
| ) |
const |
|
protected |
Get the decorated widget as a QFrame.
◆ eventFilter()
| bool ecvShortcutDecorator::eventFilter |
( |
QObject * |
obj, |
|
|
QEvent * |
event |
|
) |
| |
|
overrideprotected |
Monitor mouse events to allow users to enable/disable shortcuts.
◆ isEnabled()
| bool ecvShortcutDecorator::isEnabled |
( |
| ) |
const |
Check if any attached shortcuts are enabled.
- Returns
- True if at least one shortcut is enabled
◆ markFrame()
| void ecvShortcutDecorator::markFrame |
( |
bool |
active, |
|
|
const QColor & |
frameColor |
|
) |
| |
|
protected |
Show/hide and color the frame border.
- Parameters
-
| active | True if the shortcut is active |
| frameColor | The color to use for the border |
◆ onShortcutDisabled
| virtual void ecvShortcutDecorator::onShortcutDisabled |
( |
| ) |
|
|
protectedvirtualslot |
Called when any shortcut is disabled. Ensures all shortcuts are disabled and marks the widget as inactive.
◆ onShortcutEnabled
| virtual void ecvShortcutDecorator::onShortcutEnabled |
( |
| ) |
|
|
protectedvirtualslot |
Called when any shortcut is enabled. Ensures all shortcuts are enabled and marks the widget as active.
◆ setEnabled
| virtual void ecvShortcutDecorator::setEnabled |
( |
bool |
enable, |
|
|
bool |
refocusWhenEnabling = false |
|
) |
| |
|
virtualslot |
Enable or disable all attached shortcuts.
- Parameters
-
| enable | True to enable, false to disable |
| refocusWhenEnabling | If true, focus will shift to the context widget |
◆ m_allowRefocus
| bool ecvShortcutDecorator::m_allowRefocus |
|
protected |
Should shortcuts set the keyboard focus to their context widget? This is set to true when users explicitly click on the widget frame and false otherwise.
Definition at line 130 of file ecvShortcutDecorator.h.
◆ m_pressed
| bool ecvShortcutDecorator::m_pressed |
|
protected |
Note when the user has pressed the mouse inside the widget and not released it.
Definition at line 122 of file ecvShortcutDecorator.h.
◆ m_shortcuts
All the shortcuts that decorate the widget. These will all be enabled/disabled en banc.
Definition at line 118 of file ecvShortcutDecorator.h.
◆ m_silent
| bool ecvShortcutDecorator::m_silent |
|
protected |
Prevent recursive signaling inside onShortcutEnabled/onShortcutDisabled.
Definition at line 125 of file ecvShortcutDecorator.h.
The documentation for this class was generated from the following file: