summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qshortcutmap.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-09-30 14:09:04 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-04 07:40:08 +0200
commitdf9d882d41b741fef7c5beeddb0abe9d904443d8 (patch)
tree6f3e90dacad4581b7f1cabe235cca298833a3da4 /src/gui/kernel/qshortcutmap.cpp
parent109e088c7c5d0c9325966e88d55fd9f7a58f67ea (diff)
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qshortcutmap.cpp')
-rw-r--r--src/gui/kernel/qshortcutmap.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index b643393430..ffe39e5c0d 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -305,7 +305,7 @@ bool QShortcutMap::tryShortcut(QKeyEvent *e)
case QKeySequence::ExactMatch: {
// Save number of identical matches before dispatching
// to keep QShortcutMap and tryShortcut reentrant.
- const int identicalMatches = d->identicals.count();
+ const int identicalMatches = d->identicals.size();
resetState();
dispatchEvent(e);
// If there are no identicals we've only found disabled shortcuts, and
@@ -389,7 +389,7 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const
QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifiers)
{
Q_D(QShortcutMap);
- if (!d->sequences.count())
+ if (!d->sequences.size())
return QKeySequence::NoMatch;
createNewSequences(e, d->newEntries, ignoredModifiers);
@@ -397,7 +397,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
// Should never happen
if (d->newEntries == d->currentSequences) {
- Q_ASSERT_X(e->key() != Qt::Key_unknown || e->text().length(),
+ Q_ASSERT_X(e->key() != Qt::Key_unknown || e->text().size(),
"QShortcutMap::find", "New sequence to find identical to previous");
return QKeySequence::NoMatch;
}
@@ -409,7 +409,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier
bool identicalDisabledFound = false;
QList<QKeySequence> okEntries;
int result = QKeySequence::NoMatch;
- for (int i = d->newEntries.count()-1; i >= 0 ; --i) {
+ for (int i = d->newEntries.size()-1; i >= 0 ; --i) {
QShortcutEntry entry(d->newEntries.at(i)); // needed for searching
const auto itEnd = d->sequences.constEnd();
auto it = std::lower_bound(d->sequences.constBegin(), itEnd, entry);
@@ -491,11 +491,11 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QList<QKeySequence> &ksl, in
QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
qCDebug(lcShortcutMap) << "Creating new sequences for" << e
<< "with ignoredModifiers=" << Qt::KeyboardModifiers(ignoredModifiers);
- int pkTotal = possibleKeys.count();
+ int pkTotal = possibleKeys.size();
if (!pkTotal)
return;
- int ssActual = d->currentSequences.count();
+ int ssActual = d->currentSequences.size();
int ssTotal = qMax(1, ssActual);
// Resize to possible permutations of the current sequence(s).
ksl.resize(pkTotal * ssTotal);