diff --git a/tests/ui/modules/Linphone/Paned.qml b/tests/ui/modules/Linphone/Paned.qml index 257cdd4d8..32f628a9d 100644 --- a/tests/ui/modules/Linphone/Paned.qml +++ b/tests/ui/modules/Linphone/Paned.qml @@ -23,11 +23,15 @@ Item { property alias childA: contentA.data property alias childB: contentB.data + property int closingEdge: Qt.LeftEdge // User limits: string or int values. property var leftLimit: 0 property var rightLimit: 0 + property bool _isClosed + property int _savedContentAWidth + // Internal limits. property var _leftLimit property var _rightLimit @@ -53,7 +57,7 @@ Item { } } - onWidthChanged: { + function _applyLimits () { var rightLimit = _getLimitValue(_rightLimit) var leftLimit = _getLimitValue(_leftLimit) @@ -68,6 +72,8 @@ Item { } } + onWidthChanged: !_isClosed && _applyLimits() + Component.onCompleted: { _leftLimit = _parseLimit(leftLimit) _rightLimit = _parseLimit(rightLimit) @@ -92,9 +98,28 @@ Item { hoverEnabled: true width: PanedStyle.handle.width + onDoubleClicked: { + // Save state and close. + if (!_isClosed) { + _isClosed = true + _savedContentAWidth = contentA.width + + contentA.width = (closingEdge !== Qt.LeftEdge) + ? container.width - width + : 0 + + return + } + + // Restore old state. + _isClosed = false + contentA.width = _savedContentAWidth + + _applyLimits() + } + onMouseXChanged: { - // Necessary because `hoverEnabled` is used. - if (!pressed) { + if (!pressed || _isClosed) { return } diff --git a/tests/ui/modules/Linphone/Styles/PanedStyle.qml b/tests/ui/modules/Linphone/Styles/PanedStyle.qml index 2d8d817a1..5b73bf29a 100644 --- a/tests/ui/modules/Linphone/Styles/PanedStyle.qml +++ b/tests/ui/modules/Linphone/Styles/PanedStyle.qml @@ -5,7 +5,7 @@ import Linphone 1.0 QtObject { property QtObject handle: QtObject { - property int width: 8 + property int width: 10 property QtObject color: QtObject { property color hovered: Colors.h