refactor: manually animate rect if needed
No need for animate prop, it's used too little so just manually set it if needed to save memory
This commit is contained in:
parent
0bac8f983a
commit
89bb774012
4 changed files with 48 additions and 24 deletions
|
|
@ -11,7 +11,6 @@ StyledRect {
|
|||
|
||||
property color colour: Colours.palette.pink
|
||||
|
||||
animate: true
|
||||
clip: true
|
||||
|
||||
MaterialIcon {
|
||||
|
|
@ -53,4 +52,20 @@ StyledRect {
|
|||
elide: Qt.ElideRight
|
||||
elideWidth: root.vertical ? BarConfig.sizes.maxLabelHeight : BarConfig.sizes.maxLabelWidth
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ StyledRect {
|
|||
|
||||
property color colour: Colours.palette.rosewater
|
||||
|
||||
animate: true
|
||||
clip: true
|
||||
|
||||
MaterialIcon {
|
||||
|
|
@ -58,4 +57,20 @@ StyledRect {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ StyledRect {
|
|||
|
||||
property color colour: Colours.palette.lavender
|
||||
|
||||
animate: true
|
||||
clip: true
|
||||
visible: width > 0 && height > 0 // To avoid warnings about being visible with no size
|
||||
|
||||
|
|
@ -22,4 +21,20 @@ StyledRect {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import QtQuick
|
|||
Rectangle {
|
||||
id: root
|
||||
|
||||
property bool animate: false
|
||||
property bool vertical: parent.vertical ?? false // Convenience property for propagation to children
|
||||
|
||||
color: "transparent"
|
||||
|
|
@ -18,24 +17,4 @@ Rectangle {
|
|||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
enabled: root.animate
|
||||
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitHeight {
|
||||
enabled: root.animate
|
||||
|
||||
NumberAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue