Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved How to access QML Surface3DSeries from C++?

    QML and Qt Quick
    1
    1
    84
    Loading More Posts
    • 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.
    • Tom asso
      Tom asso last edited by Tom asso

      How to access a qml Surface3DSeries object from C++?
      I’m having serious problems with the QObject::findChildren() approach. My main.qml declares a Surface3D with objectName “mySurface” and a Surface3DSeries item with objectName: “mySurfaceSeries”, something like this:

       Surface3D {
                 objectName: "mySurface"
                 width: parent.width
                 height: parent.height
      
                 Surface3DSeries {
                      objectName: "mySurfaceSeries"
      
                     ItemModelSurfaceDataProxy {
                       [...]
                     }
                 }
             }
      

      After loading the qml in main.cpp, my C++ code calls rootObject->findChildren<QObject *>(). The returned object tree contains object “mySurface” but does NOT contain object “mySurfaceSeries”. I have no idea why - I thought that every item in qml would be represented in the object tree. There are no obvious errors in the qml, and the Surface3D is displayed properly with data provided by the Surface3DSeries.

      The tree's “myService” object is not a Q3DSurface (through which I could access the series) but rather a QtDataVisualization::DeclarativeSurface which is not described anywhere that I can find. The DeclarativeSurface class is defined in qtdatavis3d/src/datavisualizationqml2/declarativesurface_p.h and contains a promising method seriesList() - but QtCreator says “No type named ‘DeclarativeSurface’ in namespace ‘QtDataVisualization’”, apparently that file is not in QtCreator’s include-file path.

      So I am at a loss right now - how can I access Surface3DSeries from C++?

      Thanks!
      Tom

      1 Reply Last reply Reply Quote 1
      • First post
        Last post