Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54133

QQuickWidget within a QTabWidget is invalidated when switching tabs

    XMLWordPrintable

Details

    • 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

        Activity

          People

            lagocs Laszlo Agocs
            philippe_renon Philippe Renon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes