Warning, /education/marble/examples/qml/position-tracking/Toggle.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 
0005 // A (gps) tracking example. Shows the current (gps) position on the map
0006 // using a small ghost image. The visibility of the track can be toggled.
0007 
0008 import Qt 4.7
0009 
0010 Rectangle {
0011     id: toggle
0012 
0013     property bool active: false
0014     property alias text: message.text
0015 
0016     signal toggled
0017 
0018     width: 100; height: 20
0019     radius: 5
0020     color: active ? "steelblue" : "gray"
0021     x: 30; y: 30
0022 
0023     Text {
0024         id: message
0025         anchors.horizontalCenter: parent.horizontalCenter
0026         anchors.verticalCenter: parent.verticalCenter
0027         anchors.margins: 10
0028         color: "white"
0029         text: ""
0030     }
0031 
0032     MouseArea {
0033         id: mouseArea
0034         anchors.fill: parent
0035         onClicked: {
0036             active = !active
0037             toggle.toggled()
0038         }
0039     }
0040 }