Commit 9d9e55c5 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Collapse): supports `target` attribute

parent 7e27ef88
......@@ -7,6 +7,10 @@ import Common.Styles 1.0
// ===================================================================
Item {
id: collapse
property var target
property bool _collapsed: false
signal collapsed (bool collapsed)
......@@ -31,22 +35,30 @@ Item {
icon: 'collapse'
iconSize: CollapseStyle.iconSize
onClicked: collapse()
onClicked: collapse.collapse()
}
// -----------------------------------------------------------------
states: [
State {
name: 'Collapsed'
when: _collapsed
states: State {
name: 'Collapsed'
when: _collapsed
PropertyChanges {
target: button
rotation: 180
}
PropertyChanges {
target: button
rotation: 180
}
]
PropertyChanges {
target: collapse.target
height: 480
maximumHeight: 99999
maximumWidth: 99999
minimumHeight: 480
}
}
transitions: Transition {
RotationAnimation {
......
......@@ -104,7 +104,7 @@ Item {
states: [
State {
name: 'Opened'
name: 'opened'
when: _isOpen
PropertyChanges {
......@@ -119,7 +119,7 @@ Item {
transitions: [
Transition {
from: ''
to: 'Opened'
to: 'opened'
NumberAnimation {
duration: PopupStyle.animation.openingDuration
......@@ -134,13 +134,13 @@ Item {
}
ScriptAction {
script: menuOpened()
script: menuopened()
}
}
},
Transition {
from: 'Opened'
from: 'opened'
to: ''
NumberAnimation {
......
......@@ -37,13 +37,11 @@ ApplicationWindow {
// Collapse.
Collapse {
Layout.preferredWidth: 25
Layout.fillHeight: parent.height
id: collapse
onCollapsed: windowStates.state = collapsed
? 'collapsed'
: ''
Layout.fillHeight: parent.height
Layout.preferredWidth: 25
target: window
}
// User info.
......@@ -221,22 +219,6 @@ ApplicationWindow {
}
}
StateGroup {
id: windowStates
states: State {
name: 'collapsed'
PropertyChanges {
height: 480
maximumHeight: 99999
maximumWidth: 99999
minimumHeight: 480
target: window
}
}
}
ListModel {
id: model1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment