Commit fe236ca4 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(Collapse): fix broken function

parent b650e35a
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<file>ui/scripts/utils.js</file> <file>ui/scripts/utils.js</file>
<file>ui/style/qmldir</file> <file>ui/style/qmldir</file>
<file>ui/style/collapse/Style.qml</file> <file>ui/style/collapse/Style.qml</file>
<file>ui/style/Constants.qml</file>
<file>ui/views/newCall.qml</file> <file>ui/views/newCall.qml</file>
<file>ui/views/manageAccounts.qml</file> <file>ui/views/manageAccounts.qml</file>
<file>ui/views/mainWindow/mainWindow.qml</file> <file>ui/views/mainWindow/mainWindow.qml</file>
......
...@@ -8,16 +8,20 @@ import 'qrc:/ui/style' ...@@ -8,16 +8,20 @@ import 'qrc:/ui/style'
// =================================================================== // ===================================================================
Item { Item {
property bool _isCollapsed: false property bool _collapsed: false
signal collapsed (bool collapsed) signal collapsed (bool collapsed)
function collapse () { function collapse () {
_isCollapsed = !_isCollapsed _collapsed = !_collapsed
collapsed(_isCollapsed) collapsed(_collapsed)
rotate.start() rotate.start()
} }
function isCollapsed () {
return _collapsed
}
ActionButton { ActionButton {
id: button id: button
...@@ -34,9 +38,9 @@ Item { ...@@ -34,9 +38,9 @@ Item {
direction: RotationAnimation.Clockwise direction: RotationAnimation.Clockwise
duration: CollapseStyle.animationDuration duration: CollapseStyle.animationDuration
from: _isCollapsed ? 0 : 180 from: _collapsed ? 0 : 180
property: 'rotation' property: 'rotation'
target: button target: button
to: _isCollapsed ? 180 : 0 to: _collapsed ? 180 : 0
} }
} }
import QtQuick 2.0 import QtQuick 2.0
import 'qrc:/ui/style'
// =================================================================== // ===================================================================
// Helper to handle button click outside a component. // Helper to handle button click outside a component.
// =================================================================== // ===================================================================
...@@ -67,7 +69,7 @@ Item { ...@@ -67,7 +69,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
propagateComposedEvents: true propagateComposedEvents: true
z: 9999999999 // Ugly! But it's necessary in some cases... z: Constants.zMax
onPressed: { onPressed: {
// Propagate event. // Propagate event.
......
module Style module Style
singleton Constants 1.0 Constants.qml
singleton CollapseStyle 1.0 collapse/Style.qml singleton CollapseStyle 1.0 collapse/Style.qml
...@@ -37,7 +37,7 @@ ApplicationWindow { ...@@ -37,7 +37,7 @@ ApplicationWindow {
Layout.fillHeight: parent.height Layout.fillHeight: parent.height
id: collapse id: collapse
onCollapsed: mainWindowStates.state = collapsed onCollapsed: mainWindowStates.state = isCollapsed()
? 'collapsed' ? 'collapsed'
: '' : ''
} }
...@@ -70,7 +70,7 @@ ApplicationWindow { ...@@ -70,7 +70,7 @@ ApplicationWindow {
onMenuClosed: content.enabled = true onMenuClosed: content.enabled = true
onMenuOpened: { onMenuOpened: {
if (!collapse.isCollapsed) { if (!collapse.isCollapsed()) {
collapse.collapse() collapse.collapse()
} }
content.enabled = false content.enabled = false
......
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