diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 08:20:36 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-10 20:28:01 +0200 |
commit | 7f0d702f4e568790dfdfd916fa3c2da5ec78c6df (patch) | |
tree | 617646d5471b9da4126c33ff95e6670406bf62d7 /src/compositor/extensions | |
parent | f047e8b9786df0fbee307a0ec425eea385ab6657 (diff) | |
download | qtwayland-7f0d702f4e568790dfdfd916fa3c2da5ec78c6df.tar.gz |
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
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',
with the extended set of container classes recognized.
Change-Id: I574208abc90a8042b500b3f96e3862b0ff339eb6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/compositor/extensions')
-rw-r--r-- | src/compositor/extensions/qwaylandtextinput.cpp | 6 | ||||
-rw-r--r-- | src/compositor/extensions/qwlqttouch.cpp | 4 | ||||
-rw-r--r-- | src/compositor/extensions/qwltexturesharingextension.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp index 766faf16..933f3120 100644 --- a/src/compositor/extensions/qwaylandtextinput.cpp +++ b/src/compositor/extensions/qwaylandtextinput.cpp @@ -105,10 +105,10 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event) if (event->replacementLength() > 0 || event->replacementStart() != 0) { // Remove replacement - afterCommit.cursorPosition = qBound(0, afterCommit.cursorPosition + event->replacementStart(), afterCommit.surroundingText.length()); + afterCommit.cursorPosition = qBound(0, afterCommit.cursorPosition + event->replacementStart(), afterCommit.surroundingText.size()); afterCommit.surroundingText.remove(afterCommit.cursorPosition, qMin(event->replacementLength(), - afterCommit.surroundingText.length() - afterCommit.cursorPosition)); + afterCommit.surroundingText.size() - afterCommit.cursorPosition)); if (event->replacementStart() <= 0 && (event->replacementLength() >= -event->replacementStart())) { const int selectionStart = qMin(currentState->cursorPosition, currentState->anchorPosition); @@ -124,7 +124,7 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event) // Insert commit string afterCommit.surroundingText.insert(afterCommit.cursorPosition, event->commitString()); - afterCommit.cursorPosition += event->commitString().length(); + afterCommit.cursorPosition += event->commitString().size(); afterCommit.anchorPosition = afterCommit.cursorPosition; for (const QInputMethodEvent::Attribute &attribute : event->attributes()) { diff --git a/src/compositor/extensions/qwlqttouch.cpp b/src/compositor/extensions/qwlqttouch.cpp index 89753cc1..1435dde1 100644 --- a/src/compositor/extensions/qwlqttouch.cpp +++ b/src/compositor/extensions/qwlqttouch.cpp @@ -33,13 +33,13 @@ static inline int toFixed(qreal f) bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandSurface *surface) { const QList<QTouchEvent::TouchPoint> points = event->points(); - const int pointCount = points.count(); + const int pointCount = points.size(); if (!pointCount) return false; wl_client *surfaceClient = surface->client()->client(); uint32_t time = m_compositor->currentTimeMsecs(); - const int rescount = m_resources.count(); + const int rescount = m_resources.size(); for (int res = 0; res < rescount; ++res) { Resource *target = m_resources.at(res); diff --git a/src/compositor/extensions/qwltexturesharingextension.cpp b/src/compositor/extensions/qwltexturesharingextension.cpp index 9d7810a1..ef8961e4 100644 --- a/src/compositor/extensions/qwltexturesharingextension.cpp +++ b/src/compositor/extensions/qwltexturesharingextension.cpp @@ -399,7 +399,7 @@ void QWaylandTextureSharingExtension::cleanupBuffers() void QWaylandTextureSharingExtension::dumpBufferInfo() { - qDebug() << "shared buffers:" << m_server_buffers.count(); + qDebug() << "shared buffers:" << m_server_buffers.size(); for (auto it = m_server_buffers.cbegin(); it != m_server_buffers.cend(); ++it) qDebug() << " " << it.key() << ":" << it.value().buffer << "in use" << it.value().buffer->bufferInUse() << "usedLocally" << it.value().usedLocally ; } |