FluentUI/src/controls/FluMenuItem.qml

41 lines
891 B
QML
Raw Normal View History

2023-03-02 18:21:43 +08:00
import QtQuick 2.15
import QtQuick.Controls 2.15
2023-03-02 23:58:50 +08:00
Item {
2023-03-02 18:21:43 +08:00
2023-03-02 23:58:50 +08:00
id:root
width: 140
height: 32
2023-03-02 18:21:43 +08:00
2023-03-02 23:58:50 +08:00
property string text: "MenuItem"
signal clicked
2023-03-02 18:21:43 +08:00
2023-03-02 23:58:50 +08:00
Rectangle{
anchors.centerIn: parent
width: 100
height: 32
radius: 4
color:{
if(mouse_area.containsMouse){
return FluApp.isDark ? Qt.rgba(56/255,56/255,56/255,1) : Qt.rgba(230/255,230/255,230/255,1)
}
return FluApp.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
}
2023-03-02 18:21:43 +08:00
2023-03-02 23:58:50 +08:00
FluText{
text: root.text
anchors.centerIn: parent
}
MouseArea{
id:mouse_area
hoverEnabled: true
anchors.fill: parent
onClicked: {
root.clicked()
root.parent.closePopup()
}
}
}
2023-03-02 18:21:43 +08:00
}