1
0
Fork 0
flightgear/src/GUI/qml/Button.qml
James Turner 205fadbff3 Stubbing out Add-ons controller
Also CatalogListModel stubs
2018-04-08 23:52:27 +01:00

41 lines
1,010 B
QML

import QtQuick 2.4
import "."
Rectangle {
id: root
property string text
property string hoverText: ""
property bool enabled: true
property bool destructiveAction: false
readonly property string __baseColor: destructiveAction ? Style.destructiveActionColor : Style.themeColor
signal clicked
width: Math.max(Style.strutSize * 2, buttonText.implicitWidth + radius * 2)
height: buttonText.implicitHeight + (radius * 2)
radius: Style.roundRadius
color: enabled ? (mouse.containsMouse ? Style.activeColor : __baseColor) : 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();
}
}
}