1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-12 18:55:39 +02:00

mainview: make sidepanel fully resizable

GitLab: #306
Change-Id: I13b58a5069968782e30005fe9418f99ac3c15c97
This commit is contained in:
Sébastien Blin 2021-12-17 14:04:40 -05:00
parent 4f56561fdd
commit 7139eecce3

View file

@ -38,7 +38,7 @@ Rectangle {
objectName: "mainView" objectName: "mainView"
property int sidePanelViewStackMinimumWidth: 300 property int sidePanelViewStackCurrentWidth: 300
property int mainViewStackPreferredWidth: 425 property int mainViewStackPreferredWidth: 425
property int settingsViewPreferredWidth: 460 property int settingsViewPreferredWidth: 460
property int onWidthChangedTriggerDistance: 5 property int onWidthChangedTriggerDistance: 5
@ -154,7 +154,7 @@ Rectangle {
sidePanelViewStack.push(settingsMenu, StackView.Immediate) sidePanelViewStack.push(settingsMenu, StackView.Immediate)
var windowCurrentMinimizedSize = settingsViewPreferredWidth var windowCurrentMinimizedSize = settingsViewPreferredWidth
+ sidePanelViewStackMinimumWidth + onWidthChangedTriggerDistance + sidePanelViewStackCurrentWidth + onWidthChangedTriggerDistance
if (appWindow.width < windowCurrentMinimizedSize) if (appWindow.width < windowCurrentMinimizedSize)
appWindow.width = windowCurrentMinimizedSize appWindow.width = windowCurrentMinimizedSize
} }
@ -262,10 +262,8 @@ Rectangle {
Rectangle { Rectangle {
id: mainViewSidePanelRect id: mainViewSidePanelRect
SplitView.minimumWidth: sidePanelViewStackMinimumWidth SplitView.maximumWidth: splitView.width
SplitView.maximumWidth: (sidePanelOnly ? SplitView.preferredWidth: sidePanelViewStackCurrentWidth
splitView.width :
splitView.width - sidePanelViewStackMinimumWidth)
SplitView.fillHeight: true SplitView.fillHeight: true
color: JamiTheme.backgroundColor color: JamiTheme.backgroundColor
@ -308,11 +306,8 @@ Rectangle {
initialItem: welcomePage initialItem: welcomePage
SplitView.maximumWidth: sidePanelOnly ? SplitView.maximumWidth: splitView.width
splitView.width :
splitView.width - sidePanelViewStackMinimumWidth
SplitView.preferredWidth: mainViewStackPreferredWidth SplitView.preferredWidth: mainViewStackPreferredWidth
SplitView.minimumWidth: sidePanelViewStackMinimumWidth
SplitView.fillHeight: true SplitView.fillHeight: true
clip: true clip: true
@ -402,9 +397,8 @@ Rectangle {
onWidthChanged: { onWidthChanged: {
// Hide unnecessary stackview when width is changed. // Hide unnecessary stackview when width is changed.
var widthToCompare = previousWidth < mainView.width ? var widthToCompare = previousWidth < mainView.width ?
sidePanelViewStackMinimumWidth : 0 :
(sidePanelViewStackMinimumWidth + (inSettingsView ? settingsViewPreferredWidth : mainViewStackPreferredWidth)
(inSettingsView ? settingsViewPreferredWidth : mainViewStackPreferredWidth))
if (mainView.width < widthToCompare - onWidthChangedTriggerDistance if (mainView.width < widthToCompare - onWidthChangedTriggerDistance
&& mainViewStack.visible) { && mainViewStack.visible) {