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. How to access C++ object instantiated by QML item?

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 303 Views
  • 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 assoT Offline
    Tom assoT Offline
    Tom asso
    wrote on last edited by Tom asso
    #1

    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-worxR 1 Reply Last reply
    0
    • Tom assoT 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-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @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
      1

      • Login

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