Commit 893442db authored by Tomi Korpipää's avatar Tomi Korpipää

Use data inputs with properties

Also fix application for macOS
parent afe29dc8
......@@ -56,6 +56,16 @@
int main(int argc, char *argv[])
{
#if defined(Q_OS_MACOS)
QSurfaceFormat openGLFormat;
openGLFormat.setRenderableType(QSurfaceFormat::OpenGL);
openGLFormat.setProfile(QSurfaceFormat::CoreProfile);
openGLFormat.setMajorVersion(4);
openGLFormat.setMinorVersion(1);
openGLFormat.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(openGLFormat);
#endif
QGuiApplication app(argc, argv);
QQuickView viewer;
......
......@@ -112,21 +112,25 @@ Item {
DataInput {
id: tachometerNeedle
name: "tacho"
value: simuData.rpm
}
DataInput {
id: tachometerText
name: "tachoText"
value: (simuData.rpm / 1000.0).toFixed(1)
}
DataInput {
id: speedometerNeedle
name: "speed"
value: simuData.speed
}
DataInput {
id: speedometerText
name: "speedText"
value: useMetric ? simuData.speed.toFixed(0) : (simuData.speed / 1.625).toFixed(0)
}
DataInput {
......@@ -242,17 +246,6 @@ Item {
onTimeChanged: {
indicatorPane.time.text = time;
}
// Connect speed
onSpeedChanged: {
speedometerNeedle.setValue(speed);
if (useMetric)
speedometerText.setValue(speed.toFixed(0));
else
speedometerText.setValue((speed / 1.625).toFixed(0));
tachometerNeedle.setValue(rpm);
tachometerText.setValue((rpm / 1000.0).toFixed(1));
}
}
function menuSelect(next) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment