summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-10-08 16:41:46 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2016-11-08 16:33:10 +0000
commitef36fd02178482cd312ea551303856ef563421af (patch)
tree2fff948eaab4b987856f39dd16f943797a46dd54
parente25f2392eb4a208449c3aa53196c81583dba08dc (diff)
QGraphicsSceneBspTreeIndex: fix misleading code in event()
The old code employed a switch statement to filter timer events, but fell unconditionally through to the default case of calling QObject::event(). The final return statement following the switch is thus dead code. Fix by turning the switch into an if and returning QObject::event() unconditionally afterwards, which much better describes the intent of the code, and also fixes the GCC 7 warning about implicit fall- through in the switch (which wasn't implicit to a human, but GCC's comment-reading-capabilities are somewhat limited at this point). Change-Id: I6756a65b3679a446d09fd721dfd0adc24fdf7772 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
index ce43b1332d..9916591ffa 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -691,8 +691,7 @@ void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphics
bool QGraphicsSceneBspTreeIndex::event(QEvent *event)
{
Q_D(QGraphicsSceneBspTreeIndex);
- switch (event->type()) {
- case QEvent::Timer:
+ if (event->type() == QEvent::Timer) {
if (d->indexTimerId && static_cast<QTimerEvent *>(event)->timerId() == d->indexTimerId) {
if (d->restartIndexTimer) {
d->restartIndexTimer = false;
@@ -701,11 +700,8 @@ bool QGraphicsSceneBspTreeIndex::event(QEvent *event)
d->_q_updateIndex();
}
}
- // Fallthrough intended - support timers in subclasses.
- default:
- return QObject::event(event);
}
- return true;
+ return QObject::event(event);
}
QT_END_NAMESPACE