summaryrefslogtreecommitdiffhomepage
path: root/gui/keyboard.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-10-25 03:11:42 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-10-25 03:11:42 +0200
commit0a1a0e9df00f37a210b67a11cf8f99550cafeeaf (patch)
tree35da3c9a2d6464025dc324647253966d4a63a351 /gui/keyboard.cpp
parenta4c9807acacc87f323f31d252a37c0ed2029ee5b (diff)
cleanups only
Diffstat (limited to 'gui/keyboard.cpp')
-rw-r--r--gui/keyboard.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index b9964ecb..aa8f67a3 100644
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -2,11 +2,11 @@
#include <QDebug>
-keyboard_listener::keyboard_listener(QWidget* parent) :
- QDialog(parent)
-#if defined _WIN32
- , token([this](const Key& k) {
- if(k.guid != "")
+#ifdef _WIN32
+auto keyboard_listener::make_token()
+{
+ return [this](const Key& k) {
+ if(!k.guid.isEmpty())
{
int mods = 0;
if (k.alt) mods |= Qt::AltModifier;
@@ -19,10 +19,17 @@ keyboard_listener::keyboard_listener(QWidget* parent) :
Qt::KeyboardModifiers m;
QKeySequence k_;
if (win_key::to_qt(k, k_, m))
- emit key_pressed(static_cast<QVariant>(k_).toInt() | m);
+ emit key_pressed({ int(m), int(k_) });
}
- })
-// token initializer ends, real ctor body begins
+ };
+}
+
+#endif
+
+keyboard_listener::keyboard_listener(QWidget* parent) :
+ QDialog(parent)
+#ifdef _WIN32
+ , token(make_token())
#endif
{
ui.setupUi(this);