Kylin/Fluent/qml/Popup.qml

55 lines
1.3 KiB
QML
Raw Normal View History

2024-08-31 04:13:21 +08:00
import QtQuick as Quick
import QtQuick.Layouts
import QtQuick.Controls as Controls
import QtQuick.Window
import Fluent
Controls.Popup {
id: control
padding: 0
modal:true
parent: Controls.Overlay.overlay
x: Math.round((d.parentWidth - width) / 2)
y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.NoAutoClose
enter: Transition {
NumberAnimation {
property: "opacity"
duration: Theme.animationEnabled ? 83 : 0
from:0
to:1
}
}
height:Math.min(implicitHeight,d.parentHeight)
exit:Transition {
NumberAnimation {
property: "opacity"
duration: Theme.animationEnabled ? 83 : 0
from:1
to:0
}
}
background: Rectangle{
radius: [5,5,5,5]
color: Theme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(1,1,1,1)
Shadow{
radius: 5
}
}
QtObject{
id:d
property int parentHeight: {
if(control.parent){
return control.parent.height
}
return control.height
}
property int parentWidth: {
if(control.parent){
return control.parent.width
}
return control.width
}
}
}