Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.4.0
-
None
Description
Situation: QGraphicsView subclass which uses a context popup menu. One of the menus is "Toggle OpenGL Mode" (like the GL button in the "40000 chips" example in the qt tree). When the menu it triggered, the View item calls this->setViewport() to set a new QGLWidget or QWidget (depending on the toggle). That causes a warning from Qt:
QObject: Do not delete object, 'QBoardViewViewport', during its event handler!
What's happening is that the setViewport() call is deleting the previous viewport, which is fine and expected. But the popup menu event which triggered the whole thing actually comes in response to the viewport events, not the View itself. Thus the stepping-on-self.
Perhaps changing QAbstractScrollArea::setViewport() a bit might fix it, so instead of:
delete oldViewport;
do:
if ( oldViewport ) oldViewport->deleteLater();