From 7139eecce33e3e0134cee35f78bb81eb28248ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Fri, 17 Dec 2021 14:04:40 -0500 Subject: [PATCH] mainview: make sidepanel fully resizable GitLab: #306 Change-Id: I13b58a5069968782e30005fe9418f99ac3c15c97 --- src/mainview/MainView.qml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml index 16a978268..e9342ecd7 100644 --- a/src/mainview/MainView.qml +++ b/src/mainview/MainView.qml @@ -38,7 +38,7 @@ Rectangle { objectName: "mainView" - property int sidePanelViewStackMinimumWidth: 300 + property int sidePanelViewStackCurrentWidth: 300 property int mainViewStackPreferredWidth: 425 property int settingsViewPreferredWidth: 460 property int onWidthChangedTriggerDistance: 5 @@ -154,7 +154,7 @@ Rectangle { sidePanelViewStack.push(settingsMenu, StackView.Immediate) var windowCurrentMinimizedSize = settingsViewPreferredWidth - + sidePanelViewStackMinimumWidth + onWidthChangedTriggerDistance + + sidePanelViewStackCurrentWidth + onWidthChangedTriggerDistance if (appWindow.width < windowCurrentMinimizedSize) appWindow.width = windowCurrentMinimizedSize } @@ -262,10 +262,8 @@ Rectangle { Rectangle { id: mainViewSidePanelRect - SplitView.minimumWidth: sidePanelViewStackMinimumWidth - SplitView.maximumWidth: (sidePanelOnly ? - splitView.width : - splitView.width - sidePanelViewStackMinimumWidth) + SplitView.maximumWidth: splitView.width + SplitView.preferredWidth: sidePanelViewStackCurrentWidth SplitView.fillHeight: true color: JamiTheme.backgroundColor @@ -308,11 +306,8 @@ Rectangle { initialItem: welcomePage - SplitView.maximumWidth: sidePanelOnly ? - splitView.width : - splitView.width - sidePanelViewStackMinimumWidth + SplitView.maximumWidth: splitView.width SplitView.preferredWidth: mainViewStackPreferredWidth - SplitView.minimumWidth: sidePanelViewStackMinimumWidth SplitView.fillHeight: true clip: true @@ -402,9 +397,8 @@ Rectangle { onWidthChanged: { // Hide unnecessary stackview when width is changed. var widthToCompare = previousWidth < mainView.width ? - sidePanelViewStackMinimumWidth : - (sidePanelViewStackMinimumWidth + - (inSettingsView ? settingsViewPreferredWidth : mainViewStackPreferredWidth)) + 0 : + (inSettingsView ? settingsViewPreferredWidth : mainViewStackPreferredWidth) if (mainView.width < widthToCompare - onWidthChangedTriggerDistance && mainViewStack.visible) { -- GitLab