Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Importing C++ Visuals into QML

    General and Desktop
    3
    5
    452
    Loading More Posts
    • 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
      GoldRatio last edited by

      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 Reply Quote 0
      • VRonin
        VRonin last edited by VRonin

        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 Reply Quote 2
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          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 Reply Quote 1
          • G
            GoldRatio last edited by

            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!

            VRonin 1 Reply Last reply Reply Quote 0
            • VRonin
              VRonin @GoldRatio last edited by VRonin

              @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 Reply Quote 4
              • First post
                Last post