I am trying to render the QtCharts example on the main page:
import QtCharts
...
ChartView {
title: "Line Chart"
anchors.fill: parent
antialiasing: true
LineSeries {
name: "Line"
XYPoint {
x: 0
y: 0
}
...
}
}
I have QtCharts and QQmlCharts on the machine (Ubuntu 24.04 – everything installed with apt
):
/usr/lib/x86_64-linux-gnu/libQt6ChartsQml.so.6
/usr/lib/x86_64-linux-gnu/libQt6Charts.so.6.4.2
/usr/lib/x86_64-linux-gnu/libQt6ChartsQml.so.6.4.2
/usr/lib/x86_64-linux-gnu/libQt6ChartsQml.so
/usr/lib/x86_64-linux-gnu/libQt6Charts.so
But when I run my c++/qml application or when I just execute the qml code I get:
$ qml qml/HardwareTestScreen.qml
QQmlApplicationEngine failed to load component
file:///home/guido/codes/application/qml/HardwareTestScreen.qml:1:1: module "QtCharts" is not installed
qml: Did not load any objects, exiting.
In the machine I have also compiled and run successfully an application that uses QtCharts but with QtWidgets (w/o Qml). It works well.
2
Answers
Installing every qml6 module on Ubuntu 24.04 as this answer suggested, fixed the issue. Even though, I don't know which exact package of the whole list fixed it:
You have to add the Charts package in your CMAKE file: