From c6d0d1888488e9eea0d4917161363a1f1ad9cb67 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 6 Oct 2016 16:30:22 +0200 Subject: [PATCH] feat(Paned): it is possible to define the default area to resize when window is resized --- tests/ui/modules/Linphone/Paned.qml | 14 ++++++++++---- tests/ui/views/Calls/Calls.qml | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/tests/ui/modules/Linphone/Paned.qml b/tests/ui/modules/Linphone/Paned.qml index e3b6f0f2c..43dcb9482 100644 --- a/tests/ui/modules/Linphone/Paned.qml +++ b/tests/ui/modules/Linphone/Paned.qml @@ -26,8 +26,10 @@ Item { property alias childA: contentA.data property alias childB: contentB.data - property bool defaultClosed + property bool defaultClosed: false property int closingEdge: Qt.LeftEdge + property int defaultChildAWidth + property bool resizeAInPriority: false // User limits: string or int values. // By default: no limits. @@ -107,6 +109,8 @@ Item { // width(B) > maximum width(B). else if (maximumRightLimit != null && theoreticalBWidth > maximumRightLimit) { contentA.width = container.width - handle.width - maximumRightLimit + } else if (resizeAInPriority) { + contentA.width = container.width - handle.width - contentB.width } } @@ -210,10 +214,12 @@ Item { _minimumLeftLimit = _parseLimit(minimumLeftLimit) _minimumRightLimit = _parseLimit(minimumRightLimit) - _isClosed = defaultClosed - contentA.width = _getLimitValue(_minimumLeftLimit) + contentA.width = (defaultChildAWidth == null) + ? _getLimitValue(_minimumLeftLimit) + : defaultChildAWidth - _applyLimits() + _isClosed = defaultClosed + _savedContentAWidth = contentA.width } Item { diff --git a/tests/ui/views/Calls/Calls.qml b/tests/ui/views/Calls/Calls.qml index 50b4815af..46abe9e7e 100644 --- a/tests/ui/views/Calls/Calls.qml +++ b/tests/ui/views/Calls/Calls.qml @@ -6,16 +6,18 @@ import QtQuick.Controls 2.0 import Linphone 1.0 Window { - minimumHeight: 480 - minimumWidth: 780 - id: window + minimumHeight: 480 + minimumWidth: 960 + Paned { anchors.fill: parent + defaultChildAWidth: 250 maximumLeftLimit: 300 minimumLeftLimit: 50 + // Calls list. childA: Rectangle { anchors.fill: parent color: 'yellow' @@ -25,13 +27,17 @@ Window { } } + // Call / Chat. childB: Paned { anchors.fill: parent closingEdge: Qt.RightEdge + defaultChildAWidth: 300 defaultClosed: true - minimumLeftLimit: '40%' - minimumRightLimit: 200 + minimumLeftLimit: 250 + minimumRightLimit: 350 + resizeAInPriority: true + // Call. childA: Rectangle { anchors.fill: parent color: 'orange' @@ -41,9 +47,11 @@ Window { } } + // Chat. childB: Rectangle { anchors.fill: parent color: 'green' + Text { text: 'hello2' }