Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Integration fo Qt3D C++ back-end with QML front-end?
Forum Updated to NodeBB v4.3 + New Features

Integration fo Qt3D C++ back-end with QML front-end?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlqt3dc++qt 5.14
2 Posts 1 Posters 432 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alain38 0
    wrote on last edited by
    #1

    Hi,
    I have a full C++ application encapsulating a class derived form Qt3DWindow. This class makes a lot of stuff. Now I have to integrate this class in an application that is written with QML. So, I have a full front-end in QML containing one item for my view/window. The problem is that I do not arrive to make the migration.

    I tried to extract the root entity, add it a camera and a ForwardRenderer, as found in a QML example. But nothing is displayed. In fact even the "clear" operation is not performed. I have seen that the renderer as no surface. So I explicitely set the main window as surface. No change. I tried to put my entity in a Scene3D. No change. I tried to encapsulate all my stuff in a QWidget. But QML does not accept QWidget, according to what I found on Internet.

    So, I am a little bit desperate. If someone has the solution.
    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alain38 0
      wrote on last edited by
      #2

      OK,
      Finally we found the solution. The tip is to create a Scene3D in the qml file. And to create the camera and ForwaqrdRenderer in the QML too (and not in the C++).

          Scene3D {
              id: scene3D
              anchors.fill: parent
              anchors.margins: 10
              focus: true
      
              Root3DEntity {
                  id : root3DEntity
                  renderSettings : RenderSettings {
                      id : renderSettings
                      pickingSettings.pickMethod : pickingSettings.PrimitivePicking
      
                      activeFrameGraph: ForwardRenderer {
                          id: renderer
                          clearColor: "#4d4d4f"
      
                          camera: Camera {
                              id: camera
                              projectionType: CameraLens.PerspectiveProjection
                              fieldOfView: 45
                              nearPlane: 0.1
                              farPlane: 1000.0
                              position: Qt.vector3d(0.0, 0.0, 2.0)
                              upVector: Qt.vector3d(0.0, 1.0, 0.0)
                              viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
                          }
                      }
                  }
              }
          }
      
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved