diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 22:45:38 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 22:45:38 +0100 |
commit | 323dd162f5326b998e1c92ab4cfec8a63574023f (patch) | |
tree | fb4f0f4f7585d3cb90aef453167c7f4df0c6eeee /logic/win32-shortcuts.cpp | |
parent | 3981f867377ca0652d0cc0ababbbc30208db7e1c (diff) |
cmake: decruft, disable deprecated Qt functions
Diffstat (limited to 'logic/win32-shortcuts.cpp')
-rw-r--r-- | logic/win32-shortcuts.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp index 324b1b04..c2920071 100644 --- a/logic/win32-shortcuts.cpp +++ b/logic/win32-shortcuts.cpp @@ -121,7 +121,7 @@ static const win_key windows_key_sequences[] { { DIK_PAUSE, Qt::Key_Pause}, { DIK_NUMLOCK, Qt::Key_NumLock}, { DIK_CAPSLOCK, Qt::Key_CapsLock}, -#define key_mod(x, y) Qt::Key(int(x) | int((y))) +#define key_mod(x, y) Qt::Key(int((x)) | int((y))) { DIK_NUMPAD0, key_mod(Qt::Key_0, Qt::KeypadModifier)}, { DIK_NUMPAD0, key_mod(Qt::Key_0, Qt::KeypadModifier)}, { DIK_NUMPAD1, key_mod(Qt::Key_1, Qt::KeypadModifier)}, @@ -163,26 +163,22 @@ bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods bool win_key::from_qt(const QKeySequence& qt_, int& dik, Qt::KeyboardModifiers& mods) { // CAVEAT don't use QVariant::toUInt() or conversion fails -#if 0 - const unsigned qt = QVariant(qt_).toInt(); // verbose -#endif - const unsigned qt = (unsigned)int(qt_); // deprecated - const unsigned our_mods = qt & Qt::KeyboardModifierMask; + const unsigned qt = (unsigned)QVariant(qt_).toInt(); + const unsigned our_mods = qt & (unsigned)Qt::KeyboardModifierMask; if (qt == 0) return false; + for (const win_key& wk : windows_key_sequences) { - for (const win_key& wk : windows_key_sequences) + if (unsigned(wk.qt) == qt) { - if (unsigned(wk.qt) == qt) - { - dik = wk.win; - mods = Qt::NoModifier; - return true; - } + dik = wk.win; + mods = Qt::NoModifier; + return true; } } + { const unsigned key = qt & ~Qt::KeyboardModifierMask; for (const win_key& wk : windows_key_sequences) |