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>bb10
parent
e25f2392eb
commit
ef36fd0217
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue