Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Seeing Qml Properties in C++ and Signals associated with it
Qt 6.11 is out! See what's new in the release blog

Seeing Qml Properties in C++ and Signals associated with it

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 275 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.
  • V Offline
    V Offline
    vvolfster
    wrote on last edited by
    #1

    As the title says, I am wondering if it is possible for C++ to see the properties of a Qml Item / QtObject. And also get notified if a new property was added to it.

    For instance, I have this really simple QtObject here :

    QtObject {
       property bool a;
       property int b;
       property real c;
    }
    

    I want to know if there's some way for me to write a QmlExtension that extends QObject that would also get notified when it received new properties:

    MyCustomQmlExtensionObject {
       property bool a;
       property int b;
       property real c;
    }
    

    on C++ side, I would like to get notified that 3 properties were added to MyCustomQmlExtensionObject and how to access them (QVariant or otherwise). The reason why I'm interested in this is because I want to write some sort of mapper that packs the values of custom object tightly (think structs) and send them over UDP datagrams. Of course I can do that in C++ but it would be nice and elegant if I can somehow define simple properties in QML like a normal QtObject .

    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