feat(Collapse): supports target attribute

This commit is contained in:
Ronan Abhamon 2016-10-26 11:47:26 +02:00
parent 7e27ef88fe
commit 9d9e55c5d3
3 changed files with 29 additions and 35 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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