diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 3629341d9e..17212ba08d 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -271,6 +271,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include #include #include +#include #include #include #include @@ -2777,7 +2778,7 @@ bool QGraphicsView::viewportEvent(QEvent *event) QApplication::sendEvent(d->scene, &windowDeactivate); } break; - case QEvent::Leave: + case QEvent::Leave: { // ### This is a temporary fix for until we get proper mouse grab // events. activeMouseGrabberItem should be set to 0 if we lose the // mouse grab. @@ -2790,9 +2791,11 @@ bool QGraphicsView::viewportEvent(QEvent *event) d->useLastMouseEvent = false; // a hack to pass a viewport pointer to the scene inside the leave event Q_ASSERT(event->d == 0); + QScopedValueRollback rb(event->d); event->d = reinterpret_cast(viewport()); QApplication::sendEvent(d->scene, event); break; + } #ifndef QT_NO_TOOLTIP case QEvent::ToolTip: { QHelpEvent *toolTip = static_cast(event);