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 {
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 {
......
......@@ -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'
}
......
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