mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 19:20:59 +08:00
54 lines
1.1 KiB
QML
54 lines
1.1 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
|
|
Item {
|
|
|
|
property string text: "MenuItem"
|
|
signal clicked
|
|
|
|
id:root
|
|
width: {
|
|
if(root.parent){
|
|
return root.parent.width
|
|
}
|
|
return 140
|
|
}
|
|
height: 32
|
|
|
|
|
|
Rectangle{
|
|
anchors.centerIn: parent
|
|
width: root.width-40
|
|
height: 32
|
|
radius: 4
|
|
color:{
|
|
if(FluTheme.dark){
|
|
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)
|
|
}
|
|
}
|
|
|
|
FluText{
|
|
text: root.text
|
|
anchors.centerIn: parent
|
|
}
|
|
|
|
MouseArea{
|
|
id:mouse_area
|
|
hoverEnabled: true
|
|
anchors.fill: parent
|
|
onClicked: {
|
|
root.clicked()
|
|
root.parent.closePopup()
|
|
}
|
|
}
|
|
}
|
|
}
|