import QtQuick 2.0 import QtQuick.Controls 2.2 import "qrc:/qml" ApplicationWindow { id: tbtnavi title: "Turn By Turn Navigation Demo" height: 720 width: 640 visible: true property double vehicleSpeed: 0 property double engineSpeed: 0 Connections { target: SignalComposer onSignalEvent: { //console.log ("Received uid = " + uid + ", value = " + value) if (uid === "event.info" && value === "true") { console.log ("Switching views!") console.log ("currentIndex = " + container.currentIndex) if (container.currentIndex === 0) { console.log ("Switching to info") container.currentIndex = 1 } else if (container.currentIndex === 1) { console.log ("Switching to map") container.currentIndex = 0 } } else if (uid === "event.vehicle.speed") { var speed_tmp = parseFloat(value) if(units == "km/h") { speed_tmp /= 1.609 } vehicleSpeed = speed_tmp } else if (uid === "event.engine.speed") { engineSpeed = parseFloat(value) } } } Item { id: container anchors.centerIn: parent width: parent.width height: parent.height property int currentIndex: 0 MapWindow { visible: parent.currentIndex === 0 opacity: parent.currentIndex === 0 ? 1.0 : 0.0 anchors.fill: parent objectName: "mapwindow" } InfoWindow { visible: parent.currentIndex === 1 opacity: parent.currentIndex === 1 ? 1.0 : 0.0 anchors.fill: parent } } }