1
0
Fork 0
flightgear/src/GUI/qml/MenuItem.qml
James Turner 6dd374408c Launcher: keyboard shortcuts
Use The Qt 5.6 Shortcut item, but via a conditional file so
we don’t touch the base Qt requirement. (This means no shortcuts
when using Qt 5.4 or 5.5, oh well)
2018-07-03 09:36:30 +01:00

46 lines
1,020 B
QML

import QtQuick 2.4
import "."
BaseMenuItem {
id: root
property alias text: itemText.text
property string shortcut: "" // for compatability with Qt 5.6 and up
signal triggered();
function minWidth() {
return itemText.width + (Style.inset * 2)
}
Rectangle {
height: parent.height
width: parent.width
visible: mouse.containsMouse
color: "#cfcfcf"
}
Text {
id: itemText
font.pixelSize: Style.baseFontPixelSize
color: mouse.containsMouse ? Style.themeColor :
(root.enabled ? Style.baseTextColor : Style.disabledTextColor);
anchors {
left: parent.left
leftMargin: Style.inset
verticalCenter: parent.verticalCenter
}
}
MouseArea {
id: mouse
enabled: root.enabled
anchors.fill: parent
hoverEnabled: root.enabled
onClicked: {
root.closeMenu();
root.triggered();
}
}
}