mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-29 05:06:22 +00:00
feat(Paned): display only visible panel(s)
This commit is contained in:
parent
1d681621e7
commit
f269bda902
1 changed files with 14 additions and 4 deletions
|
|
@ -27,7 +27,7 @@ Item {
|
||||||
property alias childA: contentA.data
|
property alias childA: contentA.data
|
||||||
property alias childB: contentB.data
|
property alias childB: contentB.data
|
||||||
property bool defaultClosed: false
|
property bool defaultClosed: false
|
||||||
property int closingEdge: Qt.LeftEdge
|
property int closingEdge: Qt.LeftEdge // `LeftEdge` or `RightEdge`.
|
||||||
property int defaultChildAWidth
|
property int defaultChildAWidth
|
||||||
property bool resizeAInPriority: false
|
property bool resizeAInPriority: false
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ Item {
|
||||||
|
|
||||||
// If closed, set correctly the handle position to left or right.
|
// If closed, set correctly the handle position to left or right.
|
||||||
if (_isClosed) {
|
if (_isClosed) {
|
||||||
contentA.width = (closingEdge === Qt.RightEdge)
|
contentA.width = (closingEdge !== Qt.LeftEdge)
|
||||||
? container.width - handle.width
|
? container.width - handle.width
|
||||||
: 0
|
: 0
|
||||||
}
|
}
|
||||||
|
|
@ -161,7 +161,7 @@ Item {
|
||||||
else if (theoreticalBWidth < minimumRightLimit) {
|
else if (theoreticalBWidth < minimumRightLimit) {
|
||||||
contentA.width = container.width - handle.width - minimumRightLimit
|
contentA.width = container.width - handle.width - minimumRightLimit
|
||||||
|
|
||||||
if (closingEdge === Qt.RightEdge && offset > minimumRightLimit / 2) {
|
if (closingEdge !== Qt.LeftEdge && offset > minimumRightLimit / 2) {
|
||||||
if (_isClosed) {
|
if (_isClosed) {
|
||||||
_open()
|
_open()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -202,6 +202,14 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _isVisible (edge) {
|
||||||
|
return (
|
||||||
|
!_isClosed ||
|
||||||
|
openingTransition.running ||
|
||||||
|
closingTransition.running
|
||||||
|
) || closingEdge !== edge
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
|
||||||
onWidthChanged: _applyLimits()
|
onWidthChanged: _applyLimits()
|
||||||
|
|
@ -226,6 +234,7 @@ Item {
|
||||||
id: contentA
|
id: contentA
|
||||||
|
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
visible: _isVisible(Qt.LeftEdge)
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
@ -241,7 +250,7 @@ Item {
|
||||||
|
|
||||||
onDoubleClicked: _inverseClosingState()
|
onDoubleClicked: _inverseClosingState()
|
||||||
onMouseXChanged: pressed &&
|
onMouseXChanged: pressed &&
|
||||||
_applyLimitsOnUserMove(handle.mouseX - _mouseStart)
|
_applyLimitsOnUserMove(mouseX - _mouseStart)
|
||||||
|
|
||||||
onPressed: _mouseStart = mouseX
|
onPressed: _mouseStart = mouseX
|
||||||
|
|
||||||
|
|
@ -261,6 +270,7 @@ Item {
|
||||||
|
|
||||||
anchors.left: handle.right
|
anchors.left: handle.right
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
visible: _isVisible(Qt.RightEdge)
|
||||||
width: container.width - contentA.width - handle.width
|
width: container.width - contentA.width - handle.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue