mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(Collapse): use transitions and states attributes
This commit is contained in:
parent
5b209a04ff
commit
7e27ef88fe
1 changed files with 34 additions and 10 deletions
|
|
@ -11,16 +11,18 @@ Item {
|
|||
|
||||
signal collapsed (bool collapsed)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
function collapse () {
|
||||
_collapsed = !_collapsed
|
||||
collapsed(_collapsed)
|
||||
rotate.start()
|
||||
}
|
||||
|
||||
function isCollapsed () {
|
||||
return _collapsed
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
ActionButton {
|
||||
id: button
|
||||
|
||||
|
|
@ -32,14 +34,36 @@ Item {
|
|||
onClicked: collapse()
|
||||
}
|
||||
|
||||
RotationAnimation {
|
||||
id: rotate
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
direction: RotationAnimation.Clockwise
|
||||
duration: CollapseStyle.animationDuration
|
||||
from: _collapsed ? 0 : 180
|
||||
property: 'rotation'
|
||||
target: button
|
||||
to: _collapsed ? 180 : 0
|
||||
states: [
|
||||
State {
|
||||
name: 'Collapsed'
|
||||
when: _collapsed
|
||||
|
||||
PropertyChanges {
|
||||
target: button
|
||||
rotation: 180
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
RotationAnimation {
|
||||
direction: RotationAnimation.Clockwise
|
||||
duration: CollapseStyle.animationDuration
|
||||
property: 'rotation'
|
||||
target: button
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
PauseAnimation {
|
||||
duration: CollapseStyle.animationDuration
|
||||
}
|
||||
|
||||
ScriptAction {
|
||||
script: collapsed(_collapsed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue