summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input
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/platformsupport/input
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/platformsupport/input')
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp4
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 6691659345..b2ad52ba8d 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -565,7 +565,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
// Until that use a temporary key.
int key = m_currentData.trackingId;
if (key == -1)
- key = m_contacts.count();
+ key = m_contacts.size();
m_contacts.insert(key, m_currentData);
m_currentData = Contact();
@@ -774,7 +774,7 @@ void QEvdevTouchScreenData::reportPoints()
// Map the coordinates based on the normalized position. QPA expects 'area'
// to be in screen coordinates.
- const int pointCount = m_touchPoints.count();
+ const int pointCount = m_touchPoints.size();
for (int i = 0; i < pointCount; ++i) {
QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]);
diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index 84a05f565e..c3196676eb 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -19,7 +19,7 @@ QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t s
{
const int id = qMax(0, slot);
- for (int i = 0; i < m_points.count(); ++i)
+ for (int i = 0; i < m_points.size(); ++i)
if (m_points.at(i).id == id)
return &m_points[i];
@@ -146,7 +146,7 @@ void QLibInputTouch::processTouchUp(libinput_event_touch *e)
tp->state = QEventPoint::State::Released;
// There may not be a Frame event after the last Up. Work this around.
QEventPoint::States s;
- for (int i = 0; i < state->m_points.count(); ++i)
+ for (int i = 0; i < state->m_points.size(); ++i)
s |= state->m_points.at(i).state;
if (s == QEventPoint::State::Released)
processTouchFrame(e);
@@ -177,7 +177,7 @@ void QLibInputTouch::processTouchFrame(libinput_event_touch *e)
QWindowSystemInterface::handleTouchEvent(nullptr, state->m_touchDevice, state->m_points,
QGuiApplication::keyboardModifiers());
- for (int i = 0; i < state->m_points.count(); ++i) {
+ for (int i = 0; i < state->m_points.size(); ++i) {
QWindowSystemInterface::TouchPoint &tp(state->m_points[i]);
if (tp.state == QEventPoint::State::Released)
state->m_points.removeAt(i--);