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 between c++ and Qml
Forum Updated to NodeBB v4.3 + New Features

integration between c++ and Qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 223 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.
  • D Offline
    D Offline
    dziko147
    wrote on last edited by
    #1

    Hello I am really new in Qt/QML development .
    i tried to display radialbar in my qml dashboard using this tutoriel https://github.com/arunpkqt/RadialBarDemo .
    Currently I want to send data from c++ to qml to each individual radialbar .
    How can i do this .
    Thanks for your help

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      https://doc.qt.io/qt-5/qtqml-cppintegration-overview.html

      The easiest way to begin is:

      • create a custom subclass of QObject
      • add some Q_PROPERTY there, which will control the value of your RadialBar
      • in main.cpp, create an instance of your subclass and add it as a root context property to your QML engine
      • the context property you've added has a name - you can use it in QML to access any properties, slots and Q_INVOKABLE methods from your c++ class

      For example, if you have a property defined as:

      Q_PROPERTY(int someValue MEMBER _someValue)
      

      You can use it in QML as:

      RadialBar {
        value: yourRootContextPropertyName.someValue
      }
      

      It will update automatically when you modify the property.

      (Z(:^

      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