FluentUI/src/controls/FluMenuItem.qml

41 lines
895 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){
2023-03-06 14:22:13 +08:00
return FluTheme.isDark ? Qt.rgba(56/255,56/255,56/255,1) : Qt.rgba(230/255,230/255,230/255,1)
2023-03-02 23:58:50 +08:00
}
2023-03-06 14:22:13 +08:00
return FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
2023-03-02 23:58:50 +08:00
}
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
}