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. Qt charts integration with c++
Forum Updated to NodeBB v4.3 + New Features

Qt charts integration with c++

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 1.6k 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.
  • MankonitNewM Offline
    MankonitNewM Offline
    MankonitNew
    wrote on last edited by
    #1

    Hi there
    I'm looking for an explanation, or example, on how to integrate qt Charts QML elements with data from the c++ part.
    For example, how to draw a LineSeries QML Type, with data that are passed from a c++ object.
    All helps pages and examples that come with qt 5.7 have dummy data directly defined in the QML files.
    Thanks for your help.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You should start by reading the QML Cpp integration chapter from Qt's documentation. There you have the explanation on how to mix both worlds.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • MankonitNewM Offline
        MankonitNewM Offline
        MankonitNew
        wrote on last edited by
        #3

        Hi
        Thank you for your answer. I'm used to the QML / c++ integration, and I'm already using several of those integration scheme in my projects. However regarding this Qt Charts integration, things seems a little more confused to me. Maybe there is nothing very complicated here, but if you could be a little more specific on the mechanism to use, it would really help me a lot.

        For exmple, I want to display a Line graph on my QML page. I then declare :

        ChartView {
                 title: "Line"
                 LineSeries {
                     name: "LineSeries"
                     ...
                 }
             }
        

        In all examples, the data comes from inside the LineSeries in the QML, by declaring XYPoint in it.

        In my real case, the data has to come from a c++ object. How to make the connection between this object and the LineSeries ?

        Shall I instantiate a QLineSeries derived-object on the c++ side, and make it available in the QML context ? But how to do that in that specific case ? and ho to insert this object into my LineSeries ? I see no "data" property in this QML type, that would allow me to "point" to the proper c++ object's method.

        Thanks again for your help.
        MK

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I haven't tested it but one possible way would be to get the LineSeries object generated in your QML code from C++ and then interact with that object directly.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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