summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-09-10 17:01:33 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-09-13 12:51:52 +0200
commit6ecd157487adb945ade530d9a6e3d44eac7b445e (patch)
tree329f746560413e739e1f731926004093fefcf00b /src/gui
parent11214f4c428497a594e17972bc566d1445b681c6 (diff)
macOS: Improve QAppleKeyMapper logging
Pick-to: 6.2 Change-Id: If0018f2a1c8809e66b695949e8dc7b463c4612a6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/platform/darwin/qapplekeymapper.mm15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm
index bdf741573d..8011154c0b 100644
--- a/src/gui/platform/darwin/qapplekeymapper.mm
+++ b/src/gui/platform/darwin/qapplekeymapper.mm
@@ -551,7 +551,7 @@ const QAppleKeyMapper::KeyMap &QAppleKeyMapper::keyMapForKey(VirtualKeyCode virt
qCDebug(lcQpaKeyMapper).verbosity(0) << "\t" << qtModifiers
<< "+" << qUtf8Printable(QString::asprintf("0x%02x", virtualKey))
<< "=" << qUtf8Printable(QString::asprintf("%d / 0x%02x /", qtKey, qtKey))
- << QString::asprintf("%c", qtKey);
+ << QString(QChar(qtKey));
}
return keyMap;
@@ -578,6 +578,8 @@ QList<int> QAppleKeyMapper::possibleKeys(const QKeyEvent *event) const
{
QList<int> ret;
+ qCDebug(lcQpaKeyMapper) << "Computing possible keys for" << event;
+
const auto nativeVirtualKey = event->nativeVirtualKey();
if (!nativeVirtualKey)
return ret;
@@ -613,6 +615,17 @@ QList<int> QAppleKeyMapper::possibleKeys(const QKeyEvent *event) const
}
}
+ if (lcQpaKeyMapper().isDebugEnabled()) {
+ qCDebug(lcQpaKeyMapper) << "Possible keys:";
+ for (int keyAndModifiers : ret) {
+ auto keyCombination = QKeyCombination::fromCombined(keyAndModifiers);
+ auto keySequence = QKeySequence(keyCombination);
+ qCDebug(lcQpaKeyMapper).verbosity(0) << "\t-"
+ << keyCombination << "/" << keySequence << "/"
+ << qUtf8Printable(keySequence.toString(QKeySequence::NativeText));
+ }
+ }
+
return ret;
}