NDEVR
API Documentation
KeystrokeWidget

Allows the user to assign a keystroke to an action by displaying a button with the current keystroke assignment that when clicked, records a new keyboard assignment. More...

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

Public Member Functions

 KeystrokeWidget (KeyControllerBase *controller, QWidget *parent=nullptr)
 Constructs a KeystrokeWidget bound to the given key controller.
 KeystrokeWidget (QWidget *parent=nullptr)
 Constructs a KeystrokeWidget with no initial controller.
bool event (QEvent *event) override
 Processes generic events, including key events for recording new bindings.
void resetToDefaults ()
 Resets all key bindings to their default values.
void setController (KeyControllerBase *controller)
 Sets the key controller whose bindings this widget will display and edit.
void setShowGrabVolumeKeys (bool show)
 Sets whether the option to grab hardware volume keys is displayed.

Protected Member Functions

void cleanup ()
 Removes all UI elements and disconnects from the current controller.
bool processKeyEvent (const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) override
 Processes a key event to record a new key binding assignment.
void setup ()
 Sets up the UI layout and populates it from the current controller.
void setup (BasicKeyController *key_controller)
 Sets up the UI for a BasicKeyController with simple key bindings.
void setup (KeyController *key_controller)
 Sets up the UI for a full KeyController with advanced key bindings.

Protected Attributes

KeyControllerBasem_controller = nullptr
 The key controller being edited.
Buttonm_current_button = nullptr
 The button currently waiting for a new keystroke.
String m_current_id
 The identifier of the action currently being re-bound.
bool m_is_init = false
 Whether the widget has been initialized.
QGridLayout * m_layout = nullptr
 The grid layout for key binding rows.
QCustomScrollAream_scroll_area = nullptr
 The scroll area containing the key binding rows.
QBoxLayout * m_scroll_area_layout = nullptr
 The layout inside the scroll area.
bool m_show_grab_volume_keys = false
 Whether to display the volume key grab option.

Detailed Description

Allows the user to assign a keystroke to an action by displaying a button with the current keystroke assignment that when clicked, records a new keyboard assignment.


Definition at line 18 of file KeystrokeWidget.h.

Constructor & Destructor Documentation

◆ KeystrokeWidget() [1/2]

KeystrokeWidget::KeystrokeWidget ( QWidget * parent = nullptr)

Constructs a KeystrokeWidget with no initial controller.

Parameters
[in]parentThe parent widget.

◆ KeystrokeWidget() [2/2]

KeystrokeWidget::KeystrokeWidget ( KeyControllerBase * controller,
QWidget * parent = nullptr )

Constructs a KeystrokeWidget bound to the given key controller.

Parameters
[in]controllerThe key controller whose bindings will be displayed.
[in]parentThe parent widget.

Member Function Documentation

◆ event()

bool KeystrokeWidget::event ( QEvent * event)
override

Processes generic events, including key events for recording new bindings.

Parameters
[in]eventThe event to process.
Returns
True if the event was handled.

References event().

Referenced by event().

◆ processKeyEvent()

bool KeystrokeWidget::processKeyEvent ( const KeyEvent & key_event,
DesignObjectLookup * lookup,
Camera * camera )
overrideprotectedvirtual

Processes a key event to record a new key binding assignment.

Parameters
[in]key_eventThe key event to process.
[in]lookupThe design object lookup context.
[in]cameraThe camera context.
Returns
True if the key event was consumed for binding assignment.

Implements KeyControllerBase.

◆ setController()

void KeystrokeWidget::setController ( KeyControllerBase * controller)

Sets the key controller whose bindings this widget will display and edit.

Parameters
[in]controllerThe key controller to bind to.

◆ setShowGrabVolumeKeys()

void KeystrokeWidget::setShowGrabVolumeKeys ( bool show)

Sets whether the option to grab hardware volume keys is displayed.

Parameters
[in]showTrue to show the volume key grab option.

◆ setup() [1/2]

void KeystrokeWidget::setup ( BasicKeyController * key_controller)
protected

Sets up the UI for a BasicKeyController with simple key bindings.

Parameters
[in]key_controllerThe basic key controller to populate from.

◆ setup() [2/2]

void KeystrokeWidget::setup ( KeyController * key_controller)
protected

Sets up the UI for a full KeyController with advanced key bindings.

Parameters
[in]key_controllerThe key controller to populate from.

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