QEvdevTouchScreenData: remove use of Java-style iterators
They will be deprecated. Change-Id: Ic1281ba2543209eb9a4ba8d6653c3a3c537eb830 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
905ecdd783
commit
dca0efc70d
@ -575,9 +575,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
|||||||
m_touchPoints.clear();
|
m_touchPoints.clear();
|
||||||
Qt::TouchPointStates combinedStates;
|
Qt::TouchPointStates combinedStates;
|
||||||
|
|
||||||
QMutableHashIterator<int, Contact> it(m_contacts);
|
for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) {
|
||||||
while (it.hasNext()) {
|
auto it = i++;
|
||||||
it.next();
|
|
||||||
Contact &contact(it.value());
|
Contact &contact(it.value());
|
||||||
|
|
||||||
if (!contact.state)
|
if (!contact.state)
|
||||||
@ -600,7 +600,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
|||||||
// Avoid reporting a contact in released state more than once.
|
// Avoid reporting a contact in released state more than once.
|
||||||
if (!m_typeB && contact.state == Qt::TouchPointReleased
|
if (!m_typeB && contact.state == Qt::TouchPointReleased
|
||||||
&& !m_lastContacts.contains(key)) {
|
&& !m_lastContacts.contains(key)) {
|
||||||
it.remove();
|
m_contacts.erase(it);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,9 +608,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now look for contacts that have disappeared since the last sync.
|
// Now look for contacts that have disappeared since the last sync.
|
||||||
it = m_lastContacts;
|
for (auto it = m_lastContacts.begin(), end = m_lastContacts.end(); it != end; ++it) {
|
||||||
while (it.hasNext()) {
|
|
||||||
it.next();
|
|
||||||
Contact &contact(it.value());
|
Contact &contact(it.value());
|
||||||
int key = m_typeB ? it.key() : contact.trackingId;
|
int key = m_typeB ? it.key() : contact.trackingId;
|
||||||
if (m_typeB) {
|
if (m_typeB) {
|
||||||
@ -627,9 +625,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove contacts that have just been reported as released.
|
// Remove contacts that have just been reported as released.
|
||||||
it = m_contacts;
|
for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) {
|
||||||
while (it.hasNext()) {
|
auto it = i++;
|
||||||
it.next();
|
|
||||||
Contact &contact(it.value());
|
Contact &contact(it.value());
|
||||||
|
|
||||||
if (!contact.state)
|
if (!contact.state)
|
||||||
@ -639,7 +637,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
|
|||||||
if (m_typeB)
|
if (m_typeB)
|
||||||
contact.state = static_cast<Qt::TouchPointState>(0);
|
contact.state = static_cast<Qt::TouchPointState>(0);
|
||||||
else
|
else
|
||||||
it.remove();
|
m_contacts.erase(it);
|
||||||
} else {
|
} else {
|
||||||
contact.state = Qt::TouchPointStationary;
|
contact.state = Qt::TouchPointStationary;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user