importing QtCharts in QML causes “module not installed error” and app crash
-
wrote on 20 Apr 2020, 23:17 last edited by
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
-
wrote on 21 Apr 2020, 09:09 last edited by MEMekaniske
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..
-
wrote on 20 Apr 2020, 23:30 last edited by MEMekaniske
Hey,
Did you enable the qt charts module from the configuration list when installing Qt?
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
-
wrote on 20 Apr 2020, 23:51 last edited by
-
wrote on 21 Apr 2020, 00:18 last edited by
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 -
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 runswrote on 21 Apr 2020, 07:51 last edited byGood 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 :)
-
wrote on 21 Apr 2020, 08:57 last edited by
yeah I did that, it's still the same
#include <QApplication>
-
wrote on 21 Apr 2020, 09:09 last edited by MEMekaniske
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..
-
wrote on 21 Apr 2020, 10:47 last edited by
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!!
-
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!!
wrote on 21 Apr 2020, 12:44 last edited by@Bari aha! :)
No problem, glad i could help!
-
wrote on 8 Jan 2022, 07:43 last edited by derry 1 Aug 2022, 07:44
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!