Improve QShortcutMap debug logging

Task-number: QTBUG-116873
Change-Id: I6a2b8c25d3da8c9cbcaeb0979b4be85267ba7856
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
bb10
Tor Arne Vestbø 2023-09-14 17:33:32 +02:00
parent baac34de6f
commit e2738ca949
2 changed files with 7 additions and 5 deletions

View File

@ -115,6 +115,7 @@ public:
NativeText,
PortableText
};
Q_ENUM(SequenceFormat)
QKeySequence();
QKeySequence(const QString &key, SequenceFormat format = NativeText);
@ -135,6 +136,7 @@ public:
PartialMatch,
ExactMatch
};
Q_ENUM(SequenceMatch);
QString toString(SequenceFormat format = PortableText) const;
static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);

View File

@ -392,7 +392,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
return QKeySequence::NoMatch;
createNewSequences(e, d->newEntries, ignoredModifiers);
qCDebug(lcShortcutMap) << "Possible shortcut key sequences:" << d->newEntries;
qCDebug(lcShortcutMap) << "Possible input sequences:" << d->newEntries;
// Should never happen
if (d->newEntries == d->currentSequences) {
@ -407,15 +407,15 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
bool partialFound = false;
bool identicalDisabledFound = false;
QList<QKeySequence> okEntries;
int result = QKeySequence::NoMatch;
QKeySequence::SequenceMatch result = QKeySequence::NoMatch;
for (int i = d->newEntries.size()-1; i >= 0 ; --i) {
QShortcutEntry entry(d->newEntries.at(i)); // needed for searching
qCDebug(lcShortcutMap) << "- checking entry" << entry.id << entry.keyseq;
const auto itEnd = d->sequences.constEnd();
auto it = std::lower_bound(d->sequences.constBegin(), itEnd, entry);
int oneKSResult = QKeySequence::NoMatch;
int tempRes = QKeySequence::NoMatch;
QKeySequence::SequenceMatch oneKSResult = QKeySequence::NoMatch;
QKeySequence::SequenceMatch tempRes = QKeySequence::NoMatch;
do {
if (it == itEnd)
break;
@ -469,7 +469,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
if (result != QKeySequence::NoMatch)
d->currentSequences = okEntries;
qCDebug(lcShortcutMap) << "Returning shortcut match == " << result;
return QKeySequence::SequenceMatch(result);
return result;
}
/*! \internal