Skip to content

Commit

Permalink
tst_Gestures: fix -Wdangling-else GCC warning
Browse files Browse the repository at this point in the history
... and do a local code cleanup:

- add override
- port from foreach to C++11 ranged for loop
- remove dead code (`gestureEvent` (née event) was already
  dereferenced when we check it for null'ness, so it cannot be
  nullptr, so the condition is always true).

Pick-to: 5.15
Change-Id: Ica5e34fbe65c95f6573630f188582b90be15c8f7
Reviewed-by: Friedemann Kleint <[email protected]>
  • Loading branch information
marc-kdab committed Apr 29, 2020
1 parent 693c28b commit 05a38c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/auto/other/gestures/tst_gestures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,13 +1401,13 @@ void tst_Gestures::ungrabGesture() // a method on QWidget

QSet<QGesture*> gestures;
protected:
bool event(QEvent *event)
bool event(QEvent *event) override
{
if (event->type() == QEvent::Gesture) {
QGestureEvent *gestureEvent = static_cast<QGestureEvent*>(event);
if (gestureEvent)
foreach (QGesture *g, gestureEvent->gestures())
gestures.insert(g);
const auto eventGestures = gestureEvent->gestures();
for (QGesture *g : eventGestures)
gestures.insert(g);
}
return GestureWidget::event(event);
}
Expand Down

0 comments on commit 05a38c0

Please sign in to comment.