|
VGamepad PC
The PC app for the virtual game controller.
|
A QLineEdit subclass for capturing keyboard and mouse input for key mapping. More...
#include <buttoninputbox.hpp>
Public Member Functions | |
| ButtonInputBox (QWidget *parent=nullptr) | |
| ~ButtonInputBox () override=default | |
| KeyCodeType | keyCode () const |
| Returns the captured platform-native key code. | |
| void | clearKeyCode () |
| Clears the captured key code and display name. | |
| QString | displayName () const |
| Returns the human-readable display name of the captured key. | |
| void | setDisplayName (const QString &displayName) |
| Sets the display name without changing the key code. | |
| void | setKeyCodeAndDisplayName (KeyCodeType vk, const QString &displayName) |
| Sets both the key code and display name. | |
Protected Member Functions | |
| bool | event (QEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| Captures a key press and stores the platform-native key code. | |
| void | mousePressEvent (QMouseEvent *event) override |
Private Member Functions | |
| void | updateDisplay () |
Private Attributes | |
| KeyCodeType | m_vk = 0 |
| QString | m_displayName |
A QLineEdit subclass for capturing keyboard and mouse input for key mapping.
This widget captures a single key press or mouse button click and stores the platform-native key code for use in input simulation.
|
explicit |
|
overridedefault |
| void ButtonInputBox::clearKeyCode | ( | ) |
Clears the captured key code and display name.
| QString ButtonInputBox::displayName | ( | ) | const |
Returns the human-readable display name of the captured key.
|
overrideprotected |
| KeyCodeType ButtonInputBox::keyCode | ( | ) | const |
Returns the captured platform-native key code.
|
overrideprotected |
Captures a key press and stores the platform-native key code.
Qt provides two native key identifiers, but their meaning differs by platform:
Since KeyboardInjector uses libevdev/uinput, we use nativeScanCode() on Linux.
| Key | nativeVirtualKey() | nativeScanCode() |
|---|---|---|
| K | 107 (XK_k) | 37 (KEY_K) |
| A | 97 (XK_a) | 30 (KEY_A) |
| Enter | 0xff0d (XK_Return) | 28 (KEY_ENTER) |
|
overrideprotected |
| void ButtonInputBox::setDisplayName | ( | const QString & | displayName | ) |
Sets the display name without changing the key code.
| void ButtonInputBox::setKeyCodeAndDisplayName | ( | KeyCodeType | vk, |
| const QString & | displayName ) |
Sets both the key code and display name.
|
private |
|
private |
|
private |