I’m trying to call 3 files in my dashboard.qml file : speed, RPM and EngCoolTemp. The RPM and EngCoolTemp are called correctly with no error but when i call speed it gives me the “property name <> invalid. (M16)” error; here’s the code:
import QtQuick 6.2
import QtQuick.Controls 6.2
Item {
id: id_dashboard
// To create data for demonstration purposes
property int countSpeed: 0
property int countRPM: 0
property int countEngCoolTemp: 0
Timer {
id: id_timer
repeat: true
interval: 1000
running: true
onTriggered: {
updateSpeed();
updateEngCoolTemp();
updateRPM();
}
}
// Speed Gauge
Rectangle {
id: id_speedArea
anchors {
horizontalCenter: parent.horizontalCenter
}
width: parent.width * 0.4
height: width
color: "black"
radius: width / 2
z: 1
speed {
id: id_speed
anchors.fill: id_speedArea
anchors.margins: id_speedArea.width * 0.025
}
}
// RPM Gauge
Rectangle {
id: id_RPMArea
anchors {
bottom: id_speedArea.bottom
}
x: parent.width / 20
width: parent.width * 0.35
height: width
color: "black"
radius: width / 2
RPM {
id: id_RPM
anchors.fill: id_RPMArea
anchors.margins: id_RPMArea.width * 0.025
}
}
// Engine Coolant Temperature Gauge
Rectangle {
id: id_EngCoolTempArea
anchors {
bottom: id_speedArea.bottom
}
x: parent.width - parent.width / 2.5
width: parent.width * 0.35
height: width
color: "black"
radius: width / 2
EngCoolTemp {
id: id_EngCoolTemp
anchors.fill: id_EngCoolTempArea
anchors.margins: id_EngCoolTempArea.width * 0.025
}
}
// Divider
Rectangle {
id: id_divider
anchors {
bottom: id_speedArea.bottom
left: id_RPMArea.horizontalCenter
right: id_EngCoolTempArea.horizontalCenter
}
height: id_RPMArea.width / 2
color: "black"
z: -1
}
function updateSpeed() {
countSpeed++;
if (countSpeed % 2 === 0) {
id_speed.value = 0;
} else {
id_speed.value = 280;
}
}
function updateEngCoolTemp() {
countEngCoolTemp++;
if (countEngCoolTemp % 3 === 0) {
if (id_EngCoolTemp.value === 0) {
id_EngCoolTemp.value = 120;
} else {
id_EngCoolTemp.value = 50;
}
}
}
function updateRPM() {
countRPM++;
if (countRPM % 2 === 0) {
if (id_RPM.value === 0) {
id_RPM.value = 7000;
} else {
id_RPM.value = 0;
}
}
}
}
how can i solve this problem.and thanks!
i tried asking chatgpt but it didn’t give me a direct solution
New contributor
Mohamed sadok Jomaa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.