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
|
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
|
|
|
|
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
|
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-16 22:06:08 +08:00
|
|
|
|
if(FluTheme.isDark){
|
|
|
|
|
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
|
|
|
|
}
|