NDEVR
API Documentation
KeystrokeWidget.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/KeyController.h>
4#include <NDEVR/String.h>
5#include <QWidget>
6class QBoxLayout;
7class QGridLayout;
8namespace NDEVR
9{
10 class QCustomLabel;
11 class Button;
12 class Toggle;
18 class NDEVR_WIDGETS_API KeystrokeWidget : public QWidget, public KeyControllerBase
19 {
20 public:
23 KeystrokeWidget(QWidget* parent = nullptr);
27 KeystrokeWidget(KeyControllerBase* controller, QWidget* parent = nullptr);
33 void setShowGrabVolumeKeys(bool show);
37 bool event(QEvent* event) override;
40 protected:
42 void setup();
45 void setup(KeyController* key_controller);
48 void setup(BasicKeyController* key_controller);
54 bool processKeyEvent(const KeyEvent& key_event, DesignObjectLookup* lookup, Camera* camera) override;
56 void cleanup();
57 protected:
59 bool m_is_init = false;
62 QBoxLayout* m_scroll_area_layout = nullptr;
63 QGridLayout* m_layout = nullptr;
66 };
67}
Assigns actions to key presses and registers them as a program-wide service.
A core widget that allows the user to click one of many button types.
Definition Button.h:68
A core object representing a user view as well as convenience functions for moving this view through ...
Definition Camera.h:95
A core class where all Design Objects including models, materials, and geometries are stored.
Forward declaration for the camera class.
A top-level controller that dispatches key events to registered sub-controllers.
Describes a user key press event used to trigger behavior in the NDEVR API.
Definition Event.h:49
KeystrokeWidget(KeyControllerBase *controller, QWidget *parent=nullptr)
Constructs a KeystrokeWidget bound to the given key controller.
String m_current_id
The identifier of the action currently being re-bound.
bool m_show_grab_volume_keys
Whether to display the volume key grab option.
void setup()
Sets up the UI layout and populates it from the current controller.
KeystrokeWidget(QWidget *parent=nullptr)
Constructs a KeystrokeWidget with no initial controller.
void setShowGrabVolumeKeys(bool show)
Sets whether the option to grab hardware volume keys is displayed.
void cleanup()
Removes all UI elements and disconnects from the current controller.
Button * m_current_button
The button currently waiting for a new keystroke.
void setController(KeyControllerBase *controller)
Sets the key controller whose bindings this widget will display and edit.
KeyControllerBase * m_controller
The key controller being edited.
bool m_is_init
Whether the widget has been initialized.
QGridLayout * m_layout
The grid layout for key binding rows.
QCustomScrollArea * m_scroll_area
The scroll area containing the key binding rows.
void resetToDefaults()
Resets all key bindings to their default values.
bool event(QEvent *event) override
Processes generic events, including key events for recording new bindings.
QBoxLayout * m_scroll_area_layout
The layout inside the scroll area.
void setup(BasicKeyController *key_controller)
Sets up the UI for a BasicKeyController with simple key bindings.
bool processKeyEvent(const KeyEvent &key_event, DesignObjectLookup *lookup, Camera *camera) override
Processes a key event to record a new key binding assignment.
void setup(KeyController *key_controller)
Sets up the UI for a full KeyController with advanced key bindings.
Displays translated text.
A scroll area is used to display the contents of a child widget within a frame.
The core String class for the NDEVR API.
Definition String.h:95
A Button that toggles between on and off.
Definition Toggle.h:50
The primary namespace for the NDEVR SDK.