Commit c6d0d188 authored by Ronan's avatar Ronan
Browse files

feat(Paned): it is possible to define the default area to resize when window is resized

parent cf031ea4
...@@ -26,8 +26,10 @@ Item { ...@@ -26,8 +26,10 @@ Item {
property alias childA: contentA.data property alias childA: contentA.data
property alias childB: contentB.data property alias childB: contentB.data
property bool defaultClosed property bool defaultClosed: false
property int closingEdge: Qt.LeftEdge property int closingEdge: Qt.LeftEdge
property int defaultChildAWidth
property bool resizeAInPriority: false
// User limits: string or int values. // User limits: string or int values.
// By default: no limits. // By default: no limits.
...@@ -107,6 +109,8 @@ Item { ...@@ -107,6 +109,8 @@ Item {
// width(B) > maximum width(B). // width(B) > maximum width(B).
else if (maximumRightLimit != null && theoreticalBWidth > maximumRightLimit) { else if (maximumRightLimit != null && theoreticalBWidth > maximumRightLimit) {
contentA.width = container.width - handle.width - maximumRightLimit contentA.width = container.width - handle.width - maximumRightLimit
} else if (resizeAInPriority) {
contentA.width = container.width - handle.width - contentB.width
} }
} }
...@@ -210,10 +214,12 @@ Item { ...@@ -210,10 +214,12 @@ Item {
_minimumLeftLimit = _parseLimit(minimumLeftLimit) _minimumLeftLimit = _parseLimit(minimumLeftLimit)
_minimumRightLimit = _parseLimit(minimumRightLimit) _minimumRightLimit = _parseLimit(minimumRightLimit)
_isClosed = defaultClosed contentA.width = (defaultChildAWidth == null)
contentA.width = _getLimitValue(_minimumLeftLimit) ? _getLimitValue(_minimumLeftLimit)
: defaultChildAWidth
_applyLimits() _isClosed = defaultClosed
_savedContentAWidth = contentA.width
} }
Item { Item {
......
...@@ -6,16 +6,18 @@ import QtQuick.Controls 2.0 ...@@ -6,16 +6,18 @@ import QtQuick.Controls 2.0
import Linphone 1.0 import Linphone 1.0
Window { Window {
minimumHeight: 480
minimumWidth: 780
id: window id: window
minimumHeight: 480
minimumWidth: 960
Paned { Paned {
anchors.fill: parent anchors.fill: parent
defaultChildAWidth: 250
maximumLeftLimit: 300 maximumLeftLimit: 300
minimumLeftLimit: 50 minimumLeftLimit: 50
// Calls list.
childA: Rectangle { childA: Rectangle {
anchors.fill: parent anchors.fill: parent
color: 'yellow' color: 'yellow'
...@@ -25,13 +27,17 @@ Window { ...@@ -25,13 +27,17 @@ Window {
} }
} }
// Call / Chat.
childB: Paned { childB: Paned {
anchors.fill: parent anchors.fill: parent
closingEdge: Qt.RightEdge closingEdge: Qt.RightEdge
defaultChildAWidth: 300
defaultClosed: true defaultClosed: true
minimumLeftLimit: '40%' minimumLeftLimit: 250
minimumRightLimit: 200 minimumRightLimit: 350
resizeAInPriority: true
// Call.
childA: Rectangle { childA: Rectangle {
anchors.fill: parent anchors.fill: parent
color: 'orange' color: 'orange'
...@@ -41,9 +47,11 @@ Window { ...@@ -41,9 +47,11 @@ Window {
} }
} }
// Chat.
childB: Rectangle { childB: Rectangle {
anchors.fill: parent anchors.fill: parent
color: 'green' color: 'green'
Text { Text {
text: 'hello2' text: 'hello2'
} }
......
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