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 ...@@ -7,6 +7,10 @@ import Common.Styles 1.0
// =================================================================== // ===================================================================
Item { Item {
id: collapse
property var target
property bool _collapsed: false property bool _collapsed: false
signal collapsed (bool collapsed) signal collapsed (bool collapsed)
...@@ -31,22 +35,30 @@ Item { ...@@ -31,22 +35,30 @@ Item {
icon: 'collapse' icon: 'collapse'
iconSize: CollapseStyle.iconSize iconSize: CollapseStyle.iconSize
onClicked: collapse() onClicked: collapse.collapse()
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------
states: [ states: State {
State { name: 'Collapsed'
name: 'Collapsed' when: _collapsed
when: _collapsed
PropertyChanges { PropertyChanges {
target: button target: button
rotation: 180 rotation: 180
}
} }
]
PropertyChanges {
target: collapse.target
height: 480
maximumHeight: 99999
maximumWidth: 99999
minimumHeight: 480
}
}
transitions: Transition { transitions: Transition {
RotationAnimation { RotationAnimation {
......
...@@ -104,7 +104,7 @@ Item { ...@@ -104,7 +104,7 @@ Item {
states: [ states: [
State { State {
name: 'Opened' name: 'opened'
when: _isOpen when: _isOpen
PropertyChanges { PropertyChanges {
...@@ -119,7 +119,7 @@ Item { ...@@ -119,7 +119,7 @@ Item {
transitions: [ transitions: [
Transition { Transition {
from: '' from: ''
to: 'Opened' to: 'opened'
NumberAnimation { NumberAnimation {
duration: PopupStyle.animation.openingDuration duration: PopupStyle.animation.openingDuration
...@@ -134,13 +134,13 @@ Item { ...@@ -134,13 +134,13 @@ Item {
} }
ScriptAction { ScriptAction {
script: menuOpened() script: menuopened()
} }
} }
}, },
Transition { Transition {
from: 'Opened' from: 'opened'
to: '' to: ''
NumberAnimation { NumberAnimation {
......
...@@ -37,13 +37,11 @@ ApplicationWindow { ...@@ -37,13 +37,11 @@ ApplicationWindow {
// Collapse. // Collapse.
Collapse { Collapse {
Layout.preferredWidth: 25
Layout.fillHeight: parent.height
id: collapse id: collapse
onCollapsed: windowStates.state = collapsed Layout.fillHeight: parent.height
? 'collapsed' Layout.preferredWidth: 25
: '' target: window
} }
// User info. // User info.
...@@ -221,22 +219,6 @@ ApplicationWindow { ...@@ -221,22 +219,6 @@ ApplicationWindow {
} }
} }
StateGroup {
id: windowStates
states: State {
name: 'collapsed'
PropertyChanges {
height: 480
maximumHeight: 99999
maximumWidth: 99999
minimumHeight: 480
target: window
}
}
}
ListModel { ListModel {
id: model1 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