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>
bb10
Marc Mutz 2016-07-05 15:13:44 +02:00
parent 3cc2884c03
commit 4927fdb389
1 changed files with 1 additions and 2 deletions

View File

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