tst_QGestureRecognizer: port away from Q_FOREACH

The single use of Q_FOREACH in this test is safe to port 1:1 to a
ranged for-loop, since we're in a constructor, and the loop body only
calls member functions of data members (incl. the base class), so we
cannot possibly modify the container passed in as a constructor
argument: any connections or event processing that could re-enter our
caller hasn't been set up, yet.

Task-number: QTBUG-115803
Change-Id: I7095aef1edddbda0d1b0c471192b18acd6fd1793
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Marc Mutz 2023-08-07 14:19:23 +02:00
parent ddcf716762
commit 081670b840

View File

@ -71,7 +71,7 @@ TestWidget::TestWidget(const GestureTypeVector &gestureTypes)
{ {
setAttribute(Qt::WA_AcceptTouchEvents); setAttribute(Qt::WA_AcceptTouchEvents);
foreach (Qt::GestureType gestureType, gestureTypes) { for (Qt::GestureType gestureType : gestureTypes) {
grabGesture(gestureType); grabGesture(gestureType);
m_receivedGestures.insert(gestureType, false); m_receivedGestures.insert(gestureType, false);
} }