mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 06:38:07 +00:00
77 lines
1.6 KiB
QML
77 lines
1.6 KiB
QML
import QtQuick 2.7
|
|
|
|
import Common.Styles 1.0
|
|
|
|
// ===================================================================
|
|
// A simple component to build collapsed item.
|
|
// ===================================================================
|
|
|
|
Item {
|
|
id: collapse
|
|
|
|
property alias target: targetChanges.target
|
|
property int targetHeight
|
|
|
|
property bool _collapsed: false
|
|
|
|
signal collapsed (bool collapsed)
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
function isCollapsed () {
|
|
return _collapsed
|
|
}
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
ActionButton {
|
|
id: button
|
|
|
|
anchors.centerIn: parent
|
|
background: CollapseStyle.background
|
|
icon: 'collapse'
|
|
iconSize: CollapseStyle.iconSize
|
|
|
|
onClicked: _collapsed = !_collapsed
|
|
}
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
states: State {
|
|
name: 'collapsed'
|
|
when: _collapsed
|
|
|
|
PropertyChanges {
|
|
rotation: 180
|
|
target: button
|
|
}
|
|
|
|
PropertyChanges {
|
|
id: targetChanges
|
|
|
|
height: collapse.targetHeight
|
|
maximumHeight: 99999
|
|
maximumWidth: 99999
|
|
minimumHeight: collapse.targetHeight
|
|
}
|
|
}
|
|
|
|
transitions: Transition {
|
|
RotationAnimation {
|
|
direction: RotationAnimation.Clockwise
|
|
duration: CollapseStyle.animationDuration
|
|
property: 'rotation'
|
|
target: button
|
|
}
|
|
|
|
SequentialAnimation {
|
|
PauseAnimation {
|
|
duration: CollapseStyle.animationDuration
|
|
}
|
|
|
|
ScriptAction {
|
|
script: collapsed(_collapsed)
|
|
}
|
|
}
|
|
}
|
|
}
|