Debian Codegraph @

src/GUI/qml/FavouriteToggleButton.qml

raw
1 import QtQuick 2.4
2 import FlightGear 1.0
3
4 Item {
5 id: root
6 property bool checked: false
7
8 implicitWidth: icon.width + Style.margin
9 implicitHeight: icon.height + Style.margin
10
11 signal toggle(var on);
12
13
14 Image {
15 id: icon
16 source: {
17 var b = mouse.containsMouse ? !root.checked : root.checked;
18 return b ? "image://colored-icon/star-filled?theme" : "image://colored-icon/star-outline?text";
19 }
20
21 anchors.centerIn: parent
22 }
23
24 MouseArea {
25 id: mouse
26 anchors.fill: parent
27 hoverEnabled: true
28 onClicked: root.toggle(!root.checked);
29
30 cursorShape: Qt.PointingHandCursor
31 }
32 }