diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 2700605a712..125174627db 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -267,6 +267,11 @@ QGraphicsWidget::~QGraphicsWidget() // Remove this graphics widget from widgetStyles widgetStyles()->setStyleForWidget(this, 0); + + // Unset the parent here, when we're still a QGraphicsWidget. + // It is otherwise done in ~QGraphicsItem() where we'd be + // calling QGraphicsWidget members on an ex-QGraphicsWidget object + setParentItem(Q_NULLPTR); } /*!