![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Decorate a widget by highlighting its frame when keyboard shortcuts are active. More...
#include <ecvShortcutDecorator.h>


Public Types | |
| using | Superclass = QObject |
Public Slots | |
| virtual void | setEnabled (bool enable, bool refocusWhenEnabling=false) |
Public Member Functions | |
| ecvShortcutDecorator (QFrame *parent) | |
| ~ecvShortcutDecorator () override=default | |
| void | addShortcut (ecvModalShortcut *shortcut) |
| bool | isEnabled () const |
Protected Slots | |
| virtual void | onShortcutEnabled () |
| virtual void | onShortcutDisabled () |
Protected Member Functions | |
| QFrame * | decoratedFrame () const |
| bool | eventFilter (QObject *obj, QEvent *event) override |
| void | markFrame (bool active, const QColor &frameColor) |
Protected Attributes | |
| QList< QPointer< ecvModalShortcut > > | m_shortcuts |
| bool | m_pressed |
| bool | m_silent |
| Prevent recursive signaling inside onShortcutEnabled/onShortcutDisabled. More... | |
| bool | m_allowRefocus |
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:
Usage:
Definition at line 41 of file ecvShortcutDecorator.h.
| using ecvShortcutDecorator::Superclass = QObject |
Definition at line 45 of file ecvShortcutDecorator.h.
|
explicit |
Create a decorator for the given widget.
| parent | The widget to decorate (must be a QFrame or subclass) |
Definition at line 21 of file ecvShortcutDecorator.cpp.
References CVLog::Error(), and markFrame().
|
overridedefault |
Destructor.
| void ecvShortcutDecorator::addShortcut | ( | ecvModalShortcut * | shortcut | ) |
Add a shortcut to this decorator. All shortcuts attached to a decorator are enabled/disabled as a group.
| shortcut | The modal shortcut to attach |
Definition at line 41 of file ecvShortcutDecorator.cpp.
References ecvModalShortcut::disabled(), ecvModalShortcut::enabled(), ecvModalShortcut::keySequence(), m_shortcuts, onShortcutDisabled(), onShortcutEnabled(), CVLog::Print(), and CVLog::Warning().
|
protected |
Get the decorated widget as a QFrame.
Definition at line 138 of file ecvShortcutDecorator.cpp.
Referenced by eventFilter(), markFrame(), and onShortcutEnabled().
|
overrideprotected |
Monitor mouse events to allow users to enable/disable shortcuts.
Definition at line 143 of file ecvShortcutDecorator.cpp.
References decoratedFrame(), event, frame, ecvKeySequences::instance(), isEnabled(), m_pressed, m_shortcuts, markFrame(), ecvKeySequences::reorder(), and setEnabled().
| bool ecvShortcutDecorator::isEnabled | ( | ) | const |
Check if any attached shortcuts are enabled.
Definition at line 64 of file ecvShortcutDecorator.cpp.
References m_shortcuts.
Referenced by eventFilter().
|
protected |
Show/hide and color the frame border.
| active | True if the shortcut is active |
| frameColor | The color to use for the border |
Definition at line 197 of file ecvShortcutDecorator.cpp.
References decoratedFrame(), and frame.
Referenced by ecvShortcutDecorator(), eventFilter(), onShortcutDisabled(), and onShortcutEnabled().
|
protectedvirtualslot |
Called when any shortcut is disabled. Ensures all shortcuts are disabled and marks the widget as inactive.
Definition at line 105 of file ecvShortcutDecorator.cpp.
References m_shortcuts, m_silent, and markFrame().
Referenced by addShortcut(), and setEnabled().
|
protectedvirtualslot |
Called when any shortcut is enabled. Ensures all shortcuts are enabled and marks the widget as active.
Definition at line 81 of file ecvShortcutDecorator.cpp.
References decoratedFrame(), frame, m_allowRefocus, m_shortcuts, m_silent, and markFrame().
Referenced by addShortcut(), and setEnabled().
|
virtualslot |
Enable or disable all attached shortcuts.
| enable | True to enable, false to disable |
| refocusWhenEnabling | If true, focus will shift to the context widget |
Definition at line 125 of file ecvShortcutDecorator.cpp.
References m_allowRefocus, onShortcutDisabled(), and onShortcutEnabled().
Referenced by eventFilter().
|
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.
Referenced by onShortcutEnabled(), and setEnabled().
|
protected |
Note when the user has pressed the mouse inside the widget and not released it.
Definition at line 122 of file ecvShortcutDecorator.h.
Referenced by eventFilter().
|
protected |
All the shortcuts that decorate the widget. These will all be enabled/disabled en banc.
Definition at line 118 of file ecvShortcutDecorator.h.
Referenced by addShortcut(), eventFilter(), isEnabled(), onShortcutDisabled(), and onShortcutEnabled().
|
protected |
Prevent recursive signaling inside onShortcutEnabled/onShortcutDisabled.
Definition at line 125 of file ecvShortcutDecorator.h.
Referenced by onShortcutDisabled(), and onShortcutEnabled().