Add verbose debug logging for QKeyMapper::possibleKeys()
Generalized from the logging used in the Apple key mapper. Change-Id: I61cc120e31b72995071756961d36f6a7fae14553 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
f8f5e2c122
commit
9ef757ed29
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user