diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-05-19 23:06:19 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-05-24 08:59:31 +0200 |
commit | dca0efc70deb114c8d22113e4d5ce60c44c5299d (patch) | |
tree | 0518dfae138394bb32a1be1d4e306e6522ae6ca5 /src/platformsupport/input/evdevtouch | |
parent | 905ecdd78349aac1933e013c5690670221f0b1f3 (diff) |
QEvdevTouchScreenData: remove use of Java-style iterators
They will be deprecated.
Change-Id: Ic1281ba2543209eb9a4ba8d6653c3a3c537eb830
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/platformsupport/input/evdevtouch')
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 2ab66efe59..c3a5391255 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -575,9 +575,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) m_touchPoints.clear(); Qt::TouchPointStates combinedStates; - QMutableHashIterator<int, Contact> it(m_contacts); - while (it.hasNext()) { - it.next(); + for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) { + auto it = i++; + Contact &contact(it.value()); if (!contact.state) @@ -600,7 +600,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) // Avoid reporting a contact in released state more than once. if (!m_typeB && contact.state == Qt::TouchPointReleased && !m_lastContacts.contains(key)) { - it.remove(); + m_contacts.erase(it); continue; } @@ -608,9 +608,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) } // Now look for contacts that have disappeared since the last sync. - it = m_lastContacts; - while (it.hasNext()) { - it.next(); + for (auto it = m_lastContacts.begin(), end = m_lastContacts.end(); it != end; ++it) { Contact &contact(it.value()); int key = m_typeB ? it.key() : contact.trackingId; if (m_typeB) { @@ -627,9 +625,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) } // Remove contacts that have just been reported as released. - it = m_contacts; - while (it.hasNext()) { - it.next(); + for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) { + auto it = i++; + Contact &contact(it.value()); if (!contact.state) @@ -639,7 +637,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) if (m_typeB) contact.state = static_cast<Qt::TouchPointState>(0); else - it.remove(); + m_contacts.erase(it); } else { contact.state = Qt::TouchPointStationary; } |