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

[5.7.0] Cannot access QML Scene3D/Entity reference from C++ code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 5.7.0 RC
    • Qt3D
    • None
    • Linux 64bit, nVidia GTX970

    Description

      When looking up for QML references by 'objectName' from C++ code, the returned pointer is always NULL. For example:

      QQuickItem *scene3D = qobject_cast<QQuickItem*>(rootObject()->findChild<QObject *>("scene3DItem"));
      QEntity *sceneEntity = qobject_cast<QEntity *>(scene3D->findChild<QObject *>("sceneRootEntity"));
      

      This prevents any interaction between the QML and C++ world, thus it is not possible to manipulate a QML scene at runtime.

      This happens either at startup when Component.onCompleted of scene3D is fired, or at runtime when calling a Q_INVOKABLE from QML asynchronously.

      Please see attached examples:

      • dynamic-scene-5.7.tar.gz exposes the plain issue
      • dynamic-scene-cpp-qml-workaround.tar.gz tries to workaround the issue by passing QML references to the C++ invokable. This was working up to 3 days ago. As of today, it segfaults when requesting a scene re-render

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            seanharmer Sean Harmer
            mcallegari79 Massimo Callegari
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes