Fix misleading code in QAbstractSpinBox::event()

A static_cast never returns nullptr unless its argument
already was nullptr. But we dereferenced 'event' already
by the time we reach this code, so the if is always true.

Fix by removing the temporary variable.

Change-Id: Ia869d37eda74f0bcdd616e1f57f429cc86e9e525
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Marc Mutz 2016-07-05 15:13:44 +02:00
parent 3cc2884c03
commit 4927fdb389

View File

@ -751,8 +751,7 @@ bool QAbstractSpinBox::event(QEvent *event)
case QEvent::HoverEnter: case QEvent::HoverEnter:
case QEvent::HoverLeave: case QEvent::HoverLeave:
case QEvent::HoverMove: case QEvent::HoverMove:
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) d->updateHoverControl(static_cast<const QHoverEvent *>(event)->pos());
d->updateHoverControl(he->pos());
break; break;
case QEvent::ShortcutOverride: case QEvent::ShortcutOverride:
if (d->edit->event(event)) if (d->edit->event(event))