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. Importing C++ Visuals into QML
Qt 6.11 is out! See what's new in the release blog

Importing C++ Visuals into QML

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.1k 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.
  • G Offline
    G Offline
    GoldRatio
    wrote on last edited by
    #1

    Hey,
    I was wondering if it is possible to import C++ visuals into QML and how to instantiate them into QML to be seen. I understand how to transport Data such as variables between the C++ backend and QML visuals to an extent, but not enough to transport visuals. For example, if I wanted to create a graph using QtCharts in C++, how will I be able to get them to be seen in the UI?

    Thanks in Advance!

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      You can't get widgets displayed inside QML ui but you can do the opposite with http://doc.qt.io/qt-5/qquickwidget.html

      Qt Charts have separate QML bindings: https://doc.qt.io/qt-5.11/qtcharts-qmlmodule.html

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

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

        Hi,

        Depending on what you want to do, KDAB's DeclarativeWidgets project might be of interest.

        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
        1
        • G Offline
          G Offline
          GoldRatio
          wrote on last edited by
          #4

          So to clarify, I can't get any C++ visual displayed in QML? So if I made something using the vtk library in a C++ backend, It couldn't get displayed? Thanks for everything so far by the way!

          VRoninV 1 Reply Last reply
          0
          • G GoldRatio

            So to clarify, I can't get any C++ visual displayed in QML? So if I made something using the vtk library in a C++ backend, It couldn't get displayed? Thanks for everything so far by the way!

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by VRonin
            #5

            @GoldRatio said in Importing C++ Visuals into QML:

            So if I made something using the vtk library in a C++ backend, It couldn't get displayed?

            https://gist.github.com/nocnokneo/c3fb01bb7ecaf437f7d6

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            4

            • Login

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