FluentUI/src/controls/FluMenuItem.qml

54 lines
1.1 KiB
QML
Raw Normal View History

2023-03-25 13:35:21 +08:00
import QtQuick 2.15
import QtQuick.Controls 2.15
2023-03-02 18:21:43 +08:00
2023-03-02 23:58:50 +08:00
Item {
2023-03-02 18:21:43 +08:00
2023-03-27 18:24:35 +08:00
property string text: "MenuItem"
signal clicked
2023-03-02 23:58:50 +08:00
id:root
2023-03-16 14:34:20 +08:00
width: {
if(root.parent){
return root.parent.width
}
return 140
}
2023-03-02 23:58:50 +08:00
height: 32
2023-03-02 18:21:43 +08:00
2023-03-02 23:58:50 +08:00
Rectangle{
anchors.centerIn: parent
2023-03-16 14:34:20 +08:00
width: root.width-40
2023-03-02 23:58:50 +08:00
height: 32
radius: 4
color:{
2023-03-28 21:37:10 +08:00
if(FluTheme.dark){
2023-03-16 22:06:08 +08:00
if(mouse_area.containsMouse){
return Qt.rgba(1,1,1,0.05)
}
return Qt.rgba(0,0,0,0)
}else{
if(mouse_area.containsMouse){
return Qt.rgba(0,0,0,0.05)
}
return Qt.rgba(0,0,0,0)
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
}