Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.0, 5.6.1
-
None
-
msys2 with Qt 5.6.1
ubuntu with Qt 5.6.0
-
a174ed2a996bf6311e849c8d8f31bbe307c6838b, da650dd913939042973804a7cd8c02b1fb18b66c
Description
Our Qt application embeds Qml using QQuickWidget.
Not strictly related to the issue, we also use a QQuickFramebufferObject to do OpenGL rendering (using OpenSceneGraph).
This means that at some point we need to release GL resources.
According to the documentation, a proper time to do it when receiving a QQuickWindow::sceneGraphInvalidated signal.
This signal is fired when:
1. switching tabs and the QQuickWidget becomes invisible (but not when minimizing the application window or when obscuring it with another app)
2. when disposing the QQuickWidget
Problem is that it is not possible to distinguish the two cases.
This forces us to release our OpenGL scene when closing and when switching tabs. The later is bad because rebuilding the scene is expensive (and potentially slow) and some state is lost unless persisted somewhere (which is not the case).
We understand that the above behavior is documented (http://doc.qt.io/qt-5/qquickitem.html#graphics-resource-handling) but we did not find any workaround.
We tried to use QQuickWindow::scheduleRenderJob() from QQuickItem::releaseResources() but the jobs don't run, probably because it is too late.
We tried to change both setPersistentOpenGLContext / setPersistentSceneGraph to false.
Other places to release resources (destructors, ...) either exhibit the same problem or are inappropriate (gl context not active anymore or destroyed).
To resume, a QQuickWidget within a QTabWidget should respect the setPersistentOpenGLContext / setPersistentSceneGraph settings.
Attachments
For Gerrit Dashboard: QTBUG-54133 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
162931,5 | Add a tab widget to QQuickWidget example | dev | qt/qtdeclarative | Status: MERGED | -2 | 0 |
163284,3 | Make QQuickWidget honor QQuickWindow::isPersistentSceneGraph | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
163286,4 | Handle AA_ShareOpenGLContexts consistently in QQuickWidget | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
163295,3 | Remove misleading out of date comments in QQuickWindowPrivate | 5.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |