importing QtCharts in QML causes “module not installed error” and app crash
-
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
image url)
-
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..
-
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
-
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 -
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 :)
-
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..