This commit is contained in:
zhuzichu 2024-01-25 17:06:38 +08:00
parent 3dfca40680
commit 08dbd1d11b
2 changed files with 26 additions and 8 deletions

View File

@ -11,6 +11,15 @@ Item {
id:control id:control
implicitHeight: Math.max((layout_header.height + layout_container.height),layout_header.height) implicitHeight: Math.max((layout_header.height + layout_container.height),layout_header.height)
implicitWidth: 400 implicitWidth: 400
QtObject{
id:d
property bool flag: false
function toggle(){
d.flag = true
expand = !expand
d.flag = false
}
}
Rectangle{ Rectangle{
id:layout_header id:layout_header
width: parent.width width: parent.width
@ -23,7 +32,7 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
expand = !expand d.toggle()
} }
} }
FluText{ FluText{
@ -47,7 +56,7 @@ Item {
return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
} }
onClicked: { onClicked: {
expand = !expand d.toggle()
} }
contentItem: FluIcon{ contentItem: FluIcon{
rotation: expand?0:180 rotation: expand?0:180
@ -105,7 +114,7 @@ Item {
to:"expand" to:"expand"
NumberAnimation { NumberAnimation {
properties: "anchors.topMargin" properties: "anchors.topMargin"
duration: FluTheme.enableAnimation ? 167 : 0 duration: FluTheme.enableAnimation && d.flag ? 167 : 0
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
}, },
@ -113,7 +122,7 @@ Item {
to:"collapsed" to:"collapsed"
NumberAnimation { NumberAnimation {
properties: "anchors.topMargin" properties: "anchors.topMargin"
duration: FluTheme.enableAnimation ? 167 : 0 duration: FluTheme.enableAnimation && d.flag ? 167 : 0
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }

View File

@ -11,6 +11,15 @@ Item {
id:control id:control
implicitHeight: Math.max((layout_header.height + layout_container.height),layout_header.height) implicitHeight: Math.max((layout_header.height + layout_container.height),layout_header.height)
implicitWidth: 400 implicitWidth: 400
QtObject{
id:d
property bool flag: false
function toggle(){
d.flag = true
expand = !expand
d.flag = false
}
}
Rectangle{ Rectangle{
id:layout_header id:layout_header
width: parent.width width: parent.width
@ -23,7 +32,7 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
expand = !expand d.toggle()
} }
} }
FluText{ FluText{
@ -47,7 +56,7 @@ Item {
return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
} }
onClicked: { onClicked: {
expand = !expand d.toggle()
} }
contentItem: FluIcon{ contentItem: FluIcon{
rotation: expand?0:180 rotation: expand?0:180
@ -105,7 +114,7 @@ Item {
to:"expand" to:"expand"
NumberAnimation { NumberAnimation {
properties: "anchors.topMargin" properties: "anchors.topMargin"
duration: FluTheme.enableAnimation ? 167 : 0 duration: FluTheme.enableAnimation && d.flag ? 167 : 0
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
}, },
@ -113,7 +122,7 @@ Item {
to:"collapsed" to:"collapsed"
NumberAnimation { NumberAnimation {
properties: "anchors.topMargin" properties: "anchors.topMargin"
duration: FluTheme.enableAnimation ? 167 : 0 duration: FluTheme.enableAnimation && d.flag ? 167 : 0
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }