1
0
Fork 0
flightgear/src/GUI/qml/Button.qml

40 lines
813 B
QML
Raw Normal View History

import QtQuick 2.0
2017-12-05 20:53:47 +00:00
import "."
Rectangle {
id: root
property string text
property string hoverText: ""
property bool enabled: true
signal clicked
2017-12-05 20:53:47 +00:00
width: Style.strutSize * 2
height: buttonText.implicitHeight + (radius * 2)
2017-12-05 20:53:47 +00:00
radius: Style.roundRadius
color: enabled ? (mouse.containsMouse ? Style.activeColor : Style.themeColor) : Style.disabledThemeColor
Text {
id: buttonText
anchors.centerIn: parent
color: "white"
text: (mouse.containsMouse && hoverText != "") ? root.hoverText : root.text
font.pixelSize: Style.baseFontPixelSize
}
MouseArea {
id: mouse
anchors.fill: parent
enabled: root.enabled
hoverEnabled: true
onClicked: {
root.clicked();
}
}
}