Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. importing QtCharts in QML causes “module not installed error” and app crash
Forum Updated to NodeBB v4.3 + New Features

importing QtCharts in QML causes “module not installed error” and app crash

Scheduled Pinned Locked Moved Solved Installation and Deployment
10 Posts 3 Posters 5.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.
  • B Offline
    B Offline
    Bari
    wrote on last edited by
    #1

    First time playing around with Qt I encountered a problem. When I try to import QtCharts it shows me that it's not installed.

    I created a Qt quick app and from the dropdown I add QtCharts. it gives me an error(picture below). Despite the error I can drop the chart control in the window, the program seems to compile and crashes on run

    ![11:56:43: The program has unexpectedly finished.
    11:56:43: The process was ended forcefully.]
    

    The module is installed(I checked all boxes on installation), I tried reinstalling it several times. I tried installing different versions of Qt(5.14 and 5.12)

    I added to the project file

    QT += charts
    

    When I load an example project, for example qmlaxes, everything works fine. Despite the "not installed" message also being there.

    everything seems to be working fine when I create a C++ app though

    adding to *.pro didn't help

    QT += widgets
    

    I already had

    #include <QtWidgets/QApplication>
    

    as the documentation says

    ed389625-d905-4656-a3fd-15eb9a205afd-image.png image url)

    1 Reply Last reply
    0
    • B Bari

      yeah I did that, it's still the same

      #include <QApplication>
      
      M Offline
      M Offline
      MEMekaniske
      wrote on last edited by MEMekaniske
      #7

      @Bari

      Ok, but did you change all instances of the QGuiApplication?

      #include <QApplication>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QApplication app(argc, argv); //Here etc..
      
      1 Reply Last reply
      0
      • M Offline
        M Offline
        MEMekaniske
        wrote on last edited by MEMekaniske
        #2

        Hey,

        Did you enable the qt charts module from the configuration list when installing Qt?

        2a1b7c8b-00b0-4996-97c5-10edc8893955-image.png

        You can check this and add it by using the Qt Maintenance tool.

        Edit;
        Read your post again, noticed you already had checked if it was installed.
        I would try to remove and install the component again, and if that does not work, I'd file a bug report :)

        Maybe someone else has a clue

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bari
          wrote on last edited by
          #3

          yeah I tried that with several different versions.
          I get the same error message when I load an example and try to edit it except it compiles and runs

          maintenence

          M 1 Reply Last reply
          0
          • M Offline
            M Offline
            MEMekaniske
            wrote on last edited by
            #4

            Hmm, I tried qcharts now, and examples work fine.
            But just copying the qml chart example code to my own qml app makes the app crash, as yours do.

            Though I do not get any messages about the module not being loaded, so might be a different issue.
            Will take a look at this when I wake up, as I plan to make use of charts in the future

            1 Reply Last reply
            0
            • B Bari

              yeah I tried that with several different versions.
              I get the same error message when I load an example and try to edit it except it compiles and runs

              maintenence

              M Offline
              M Offline
              MEMekaniske
              wrote on last edited by
              #5

              @Bari

              Good morning!

              At the Qt Charts documentation page, it says:
              "Note: Projects created with Qt Creator's Qt Quick Application wizard are based on the Qt Quick 2 template that uses QGuiApplication by default. All such QGuiApplication instances in the project must be replaced with QApplication as the module depends on Qt's Graphics View Framework for rendering."

              So when I replaced QGuiApplication in main,cpp with QApplication that did the trick for me :)

              1 Reply Last reply
              1
              • B Offline
                B Offline
                Bari
                wrote on last edited by
                #6

                yeah I did that, it's still the same

                #include <QApplication>
                
                M 1 Reply Last reply
                0
                • B Bari

                  yeah I did that, it's still the same

                  #include <QApplication>
                  
                  M Offline
                  M Offline
                  MEMekaniske
                  wrote on last edited by MEMekaniske
                  #7

                  @Bari

                  Ok, but did you change all instances of the QGuiApplication?

                  #include <QApplication>
                  
                  int main(int argc, char *argv[])
                  {
                      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
                      QApplication app(argc, argv); //Here etc..
                  
                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    Bari
                    wrote on last edited by
                    #8

                    o turnes out I missed one.
                    I went to change QQmlApplicationEngine also but it gave me an error so I reverted one to many changes.

                    thanks!!

                    M 1 Reply Last reply
                    0
                    • B Bari

                      o turnes out I missed one.
                      I went to change QQmlApplicationEngine also but it gave me an error so I reverted one to many changes.

                      thanks!!

                      M Offline
                      M Offline
                      MEMekaniske
                      wrote on last edited by
                      #9

                      @Bari aha! :)

                      No problem, glad i could help!

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        derry
                        wrote on last edited by derry
                        #10

                        Hi all,

                        In my case extra needed step is just delete the build folder(Debug/Release) and rebuild it again ...

                        Hope it will help someone ;)

                        thanks all!

                        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