|
Krita Source Code Documentation
|
A button that can detect input and will store its value. More...
#include <kis_input_button.h>
Inheritance diagram for KisInputButton:Classes | |
| class | Private |
Public Types | |
| enum | ButtonType { MouseType , KeyType , WheelType } |
Public Slots | |
| void | clear () |
Signals | |
| void | dataChanged () |
Public Member Functions | |
| Qt::MouseButtons | buttons () const |
| QList< Qt::Key > | keys () const |
| KisInputButton (QWidget *parent=nullptr) | |
| void | setButtons (Qt::MouseButtons newButtons) |
| void | setKeys (const QList< Qt::Key > &newKeys) |
| void | setType (ButtonType newType) |
| void | setWheel (KisShortcutConfiguration::MouseWheelMovement wheel) |
| ButtonType | type () const |
| KisShortcutConfiguration::MouseWheelMovement | wheel () const |
| ~KisInputButton () override | |
Protected Member Functions | |
| void | keyPressEvent (QKeyEvent *event) override |
| void | keyReleaseEvent (QKeyEvent *event) override |
| void | mousePressEvent (QMouseEvent *event) override |
| void | mouseReleaseEvent (QMouseEvent *) override |
| void | wheelEvent (QWheelEvent *event) override |
Private Slots | |
| void | reset () |
Private Attributes | |
| Private *const | d {nullptr} |
A button that can detect input and will store its value.
This button, when pressed, will detect input based on what type has been set. It is mainly intended for shortcut configuration, that is, picking some input that is later reused for shortcuts or similar.
Definition at line 23 of file kis_input_button.h.
The type of button.
| Enumerator | |
|---|---|
| MouseType | Detect and store any combination of pressed mouse buttons. |
| KeyType | Detect and store any combination of key presses. |
| WheelType | Detect and store mouse wheel movement. |
Definition at line 30 of file kis_input_button.h.
|
explicit |
Constructor.
Definition at line 37 of file kis_input_button.cpp.
References connect(), d, KisIconUtils::loadIcon(), reset(), and KisInputButton::Private::resetTimer.
|
override |
| Qt::MouseButtons KisInputButton::buttons | ( | ) | const |
MouseType. Definition at line 86 of file kis_input_button.cpp.
References KisInputButton::Private::buttons, and d.
|
slot |
Clear all detected input and reset the button to an empty state.
Definition at line 65 of file kis_input_button.cpp.
References KisInputButton::Private::buttons, d, KisInputButton::Private::keys, KisShortcutConfiguration::NoMovement, KisInputButton::Private::updateLabel(), and KisInputButton::Private::wheel.
|
signal |
Emitted whenever one of the values (keys, buttons, wheel) changes.
|
overrideprotected |
Definition at line 153 of file kis_input_button.cpp.
References d, KisInputButton::Private::keys, KisInputButton::Private::newInput, KisInputButton::Private::resetTimer, and KisInputButton::Private::updateLabel().
|
overrideprotected |
Definition at line 173 of file kis_input_button.cpp.
References d, KisInputButton::Private::newInput, reset(), and KisInputButton::Private::resetTimer.
| QList< Qt::Key > KisInputButton::keys | ( | ) | const |
KeyType. Definition at line 73 of file kis_input_button.cpp.
References d, and KisInputButton::Private::keys.
|
overrideprotected |
Definition at line 112 of file kis_input_button.cpp.
References KisInputButton::Private::buttons, d, MouseType, KisInputButton::Private::resetTimer, KisInputButton::Private::type, and KisInputButton::Private::updateLabel().
|
overrideprotected |
Definition at line 121 of file kis_input_button.cpp.
References d, KisInputButton::Private::newInput, reset(), and KisInputButton::Private::resetTimer.
|
privateslot |
Definition at line 186 of file kis_input_button.cpp.
References d, dataChanged(), and KisInputButton::Private::updateLabel().
| void KisInputButton::setButtons | ( | Qt::MouseButtons | newButtons | ) |
Set the mouse buttons to display.
This is mostly intended to make sure the button displays the right buttons when viewed in a dialog or similar UI.
Only applicable when type is MouseType.
| newButtons | The mouse buttons to display. |
Definition at line 91 of file kis_input_button.cpp.
References KisInputButton::Private::buttons, d, and KisInputButton::Private::updateLabel().
Set the list of keys to display.
This is mostly intended to make sure the button displays the right keys when viewed in a dialog or similar UI.
Only applicable when type is KeyType.
| newKeys | The list of keys to display. |
Definition at line 78 of file kis_input_button.cpp.
References d, KisInputButton::Private::keys, and KisInputButton::Private::updateLabel().
| void KisInputButton::setType | ( | KisInputButton::ButtonType | newType | ) |
Set the type of input this button should detect.
| newType | The type of input to detect. |
Definition at line 60 of file kis_input_button.cpp.
References d, and KisInputButton::Private::type.
| void KisInputButton::setWheel | ( | KisShortcutConfiguration::MouseWheelMovement | wheel | ) |
Set the mouse wheel movement to display.
This is mostly intended to make sure the button displays the right wheel movement when viewed in a dialog or similar UI.
Only applicable when type is WheelType.
| wheel | The wheel movement to display. |
Definition at line 104 of file kis_input_button.cpp.
References d, KisInputButton::Private::updateLabel(), and KisInputButton::Private::wheel.
| KisInputButton::ButtonType KisInputButton::type | ( | ) | const |
Definition at line 55 of file kis_input_button.cpp.
References d, and KisInputButton::Private::type.
| KisShortcutConfiguration::MouseWheelMovement KisInputButton::wheel | ( | ) | const |
WheelType. Definition at line 99 of file kis_input_button.cpp.
References d, and KisInputButton::Private::wheel.
|
overrideprotected |
Definition at line 134 of file kis_input_button.cpp.
References d, KisInputButton::Private::updateLabel(), KisInputButton::Private::wheel, KisShortcutConfiguration::WheelDown, KisShortcutConfiguration::WheelLeft, KisShortcutConfiguration::WheelRight, and KisShortcutConfiguration::WheelUp.
|
private |
Definition at line 128 of file kis_input_button.h.