diff options
author | Tor Arne Vestbø <[email protected]> | 2023-09-21 14:14:46 +0200 |
---|---|---|
committer | Tor Arne Vestbø <[email protected]> | 2023-10-11 01:48:16 +0200 |
commit | 9ef757ed2917593b94ab84868dcfee812c4d344b (patch) | |
tree | b3f9856f046732defdd50069324a62c25c512214 | |
parent | f8f5e2c122eeb1dc4d1fc1984e066bc6d9bd07ec (diff) |
Add verbose debug logging for QKeyMapper::possibleKeys()
Generalized from the logging used in the Apple key mapper.
Change-Id: I61cc120e31b72995071756961d36f6a7fae14553
Reviewed-by: Timur Pocheptsov <[email protected]>
-rw-r--r-- | src/gui/kernel/qkeymapper.cpp | 12 | ||||
-rw-r--r-- | src/gui/platform/darwin/qapplekeymapper.mm | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index 76ec7eba0dd..d62ff5657b0 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -37,6 +37,8 @@ QKeyMapper::~QKeyMapper() QList<QKeyCombination> QKeyMapper::possibleKeys(const QKeyEvent *e) { + qCDebug(lcQpaKeyMapper).verbosity(3) << "Computing possible key combinations for" << e; + const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration(); const auto *platformKeyMapper = platformIntegration->keyMapper(); QList<QKeyCombination> result = platformKeyMapper->possibleKeyCombinations(e); @@ -48,6 +50,16 @@ QList<QKeyCombination> QKeyMapper::possibleKeys(const QKeyEvent *e) result << (Qt::Key(e->text().at(0).unicode()) | e->modifiers()); } + if (lcQpaKeyMapper().isDebugEnabled()) { + qCDebug(lcQpaKeyMapper) << "Resulting possible key combinations:"; + for (auto keyCombination : result) { + auto keySequence = QKeySequence(keyCombination); + qCDebug(lcQpaKeyMapper).verbosity(0) << "\t-" + << keyCombination << "/" << keySequence << "/" + << qUtf8Printable(keySequence.toString(QKeySequence::NativeText)); + } + } + return result; } diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm index 7aefe64c6a5..944ae424b59 100644 --- a/src/gui/platform/darwin/qapplekeymapper.mm +++ b/src/gui/platform/darwin/qapplekeymapper.mm @@ -541,8 +541,6 @@ QList<QKeyCombination> QAppleKeyMapper::possibleKeyCombinations(const QKeyEvent { QList<QKeyCombination> ret; - qCDebug(lcQpaKeyMapper) << "Computing possible keys for" << event; - const auto nativeVirtualKey = event->nativeVirtualKey(); if (!nativeVirtualKey) return ret; @@ -579,16 +577,6 @@ QList<QKeyCombination> QAppleKeyMapper::possibleKeyCombinations(const QKeyEvent } } - if (lcQpaKeyMapper().isDebugEnabled()) { - qCDebug(lcQpaKeyMapper) << "Possible keys:"; - for (auto keyCombination : ret) { - auto keySequence = QKeySequence(keyCombination); - qCDebug(lcQpaKeyMapper).verbosity(0) << "\t-" - << keyCombination << "/" << keySequence << "/" - << qUtf8Printable(keySequence.toString(QKeySequence::NativeText)); - } - } - return ret; } |