Qt Forum

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

    Solved How to access C++ object instantiated by QML item?

    QML and Qt Quick
    2
    2
    124
    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

      Is it possible for my C++ backend code to access the C++ object instantiated by a QML item? In particular I want to access the QSurface3DSeries instantiated by Surface3DSeries. I understand that the backend can get a pointer to the QML item like this:

      QObject *surface3DSeries = 
             rootObject->findChild<QObject*>("mySeries");
      

      But how do I get a pointer to the QSurface3DSeries that's instantiated by surface3DSeries so that I can explicitly set its data from C++?

      Thanks
      Tom

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @Tom asso last edited by

        @tom-asso said in How to access C++ object instantiated by QML item?:
        the same way:
        rootObject->findChild<QSurface3DSeries*>()

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

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