1
0
Fork 0
flightgear/src/GUI/qml/FavouriteToggleButton.qml
2020-04-01 10:47:29 +01:00

32 lines
655 B
QML

import QtQuick 2.4
import "."
Item {
id: root
property bool checked: false
implicitWidth: icon.width + Style.margin
implicitHeight: icon.height + Style.margin
signal toggle(var on);
Image {
id: icon
source: {
var b = mouse.containsMouse ? !root.checked : root.checked;
return b ? "qrc:///favourite-icon-filled" : "qrc:///favourite-icon-outline";
}
anchors.centerIn: parent
}
MouseArea {
id: mouse
anchors.fill: parent
hoverEnabled: true
onClicked: root.toggle(!root.checked);
cursorShape: Qt.PointingHandCursor
}
}