summaryrefslogtreecommitdiffhomepage
path: root/opentrack/win32-shortcuts.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-12 16:48:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-14 18:14:46 +0200
commit216e20c26442fc3f46644635986216e8efcb96e1 (patch)
tree98bfbb1bd3bf86c69b6fdf6efd8c5fca0ffa2323 /opentrack/win32-shortcuts.cpp
parent299391ade90fc5f64e57ee6d9431b90fcaf63db8 (diff)
api/shortcuts: use unsigned index where able
Diffstat (limited to 'opentrack/win32-shortcuts.cpp')
-rw-r--r--opentrack/win32-shortcuts.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/opentrack/win32-shortcuts.cpp b/opentrack/win32-shortcuts.cpp
index fb84e709..a93803a3 100644
--- a/opentrack/win32-shortcuts.cpp
+++ b/opentrack/win32-shortcuts.cpp
@@ -163,8 +163,9 @@ bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods
bool win_key::from_qt(QKeySequence qt_, int& dik, Qt::KeyboardModifiers& mods)
{
- auto qt = static_cast<QVariant>(qt_).toInt();
- auto our_mods = qt & Qt::KeyboardModifierMask;
+ // CAVEAT don't use QVariant::toUInt() or conversion fails
+ const unsigned qt = static_cast<unsigned>(QVariant(qt_).toInt());
+ const unsigned our_mods = qt & Qt::KeyboardModifierMask;
{
const auto key_ = qt;
@@ -179,7 +180,7 @@ bool win_key::from_qt(QKeySequence qt_, int& dik, Qt::KeyboardModifiers& mods)
}
}
{
- const auto key = qt & ~Qt::KeyboardModifierMask;
+ const unsigned key = qt & ~Qt::KeyboardModifierMask;
for (auto& wk : windows_key_sequences)
{
if (wk.qt == key)