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. Is it possible to load QtCharts library with only QML without Qt/C++?
Forum Update on Monday, May 27th 2025

Is it possible to load QtCharts library with only QML without Qt/C++?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 4 Posters 755 Views
  • 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.
  • U Offline
    U Offline
    utestrauss
    wrote on last edited by
    #1

    Hi, I am a newbie in Qt/QML and need some help. As the title says, is it possible to load QtCharts library with only QML without Qt/C++ stuff? I need to develop a UI application with a chart using QML. This application runs on an embedded system on the client side. I have compiled the QtChart project as a static or shared library, but I can't get this library to work. When I try to import a static library (libqtchartsqml2.a), I get the error message "module "QtCharts" is not installed import QtCharts 2.1 ^". The libqtchartsqml2.a file is located in the path specified in the importPaths configuration, as described here. When I try to import a shared library, the application crashes with a trace, but I can't figure out what the problem is. Does anyone have a suggestion on how I can load a static or shared library into QML? I can post the trace here, but it is about 90 lines long.

    L 1 Reply Last reply
    0
    • U utestrauss

      Hi, I am a newbie in Qt/QML and need some help. As the title says, is it possible to load QtCharts library with only QML without Qt/C++ stuff? I need to develop a UI application with a chart using QML. This application runs on an embedded system on the client side. I have compiled the QtChart project as a static or shared library, but I can't get this library to work. When I try to import a static library (libqtchartsqml2.a), I get the error message "module "QtCharts" is not installed import QtCharts 2.1 ^". The libqtchartsqml2.a file is located in the path specified in the importPaths configuration, as described here. When I try to import a shared library, the application crashes with a trace, but I can't figure out what the problem is. Does anyone have a suggestion on how I can load a static or shared library into QML? I can post the trace here, but it is about 90 lines long.

      L Offline
      L Offline
      lemons
      wrote on last edited by
      #2

      @utestrauss
      Unfortunately I never tried to add QtCharts as static shared library.

      I do the following in embedded yocto projects, maybe this helps you:

      1. add QT += charts to .pro file
      2. replace QGuiApplication with QApplication in main.cpp
        -> required by QtCharts
      3. add qtcharts to yocto local.conf, rebuild embedded image and install it to the device
      IMAGE_INSTALL_append = " [... other used libraries ...] \
       qtvirtualkeyboard \
       qtcharts \
      "
      

      Note: qtcharts creates 3 packages for the embedded OS with a total of about 0.5MB:
      libqt5charts
      libqt5charts-plugins
      libqt5charts-qmlplugins

      1 Reply Last reply
      1
      • U Offline
        U Offline
        utestrauss
        wrote on last edited by utestrauss
        #3

        @lemons Thanks for the guide. I have a slightly different use case. Unfortunately I can't access the C++ side, I only work with QML files. At least I found a QML implementation of a chart library and try my luck with that.

        Anyway, it would be great if someone writes how to make QTCharts work with QML only.

        piervalliP 1 Reply Last reply
        0
        • U utestrauss

          @lemons Thanks for the guide. I have a slightly different use case. Unfortunately I can't access the C++ side, I only work with QML files. At least I found a QML implementation of a chart library and try my luck with that.

          Anyway, it would be great if someone writes how to make QTCharts work with QML only.

          piervalliP Offline
          piervalliP Offline
          piervalli
          wrote on last edited by piervalli
          #4

          @utestrauss I used this library, It is very simple, it depends what you need.
          https://github.com/qyvlik/Chart.qml. It is only qml (js)

          1 Reply Last reply
          0
          • fcarneyF Offline
            fcarneyF Offline
            fcarney
            wrote on last edited by
            #5

            I am very confused by this thread. How do you use QML without C++? Ultimately you will find something that cannot be done and have to use C++ to solve the problem. Are there build systems that don't even have you compile the main.cpp?

            C++ is a perfectly valid school of magic.

            piervalliP 1 Reply Last reply
            1
            • U Offline
              U Offline
              utestrauss
              wrote on last edited by utestrauss
              #6

              @piervalli Thanks, I use this library too. However, I wanted to use something more solid.

              @fcarney I can't tell exactly how the client's embedded system works, but yes, I am able to write UI using QML only. After deploying to the embedded system, it will be loaded and executed by QGuiApplication. At least in the trace I mentioned in the topic, I see Qt classes listed.

              1 Reply Last reply
              0
              • fcarneyF fcarney

                I am very confused by this thread. How do you use QML without C++? Ultimately you will find something that cannot be done and have to use C++ to solve the problem. Are there build systems that don't even have you compile the main.cpp?

                piervalliP Offline
                piervalliP Offline
                piervalli
                wrote on last edited by
                #7

                @fcarney
                We can write a core where you can espose all method to Qml. In this way UI can be adapted many screen without change the core.

                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