From 821285833a389eb70a2937dabf4774cb41deee51 Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu <fuzun54@outlook.com> Date: Wed, 19 Mar 2025 21:33:33 +0200 Subject: [PATCH] qml: do not use paddings in stack view Qt Quick Stack View, even though is a `Control` derivative, does not respect its paddings. This does not mean that we are free to re-interpret the paddings as done currently. Qt may at any point start respecting the padding, which would in turn break the interface. The padding is not supposed to be passed around like that. It is for the control to position the content item (apply margins). Unfortunately we can not do that in `StackView` because it assumes that it is the sole authority for positioning the content. The easy fix for that is to simply use anchors where `StackView` is reused. This is what I tried to do in this merge request. Unfortunately I could not override the padding properties as read-only to block adjusting them, as they are marked `FINAL`. --- .../gui/qt/maininterface/qml/MainDisplay.qml | 10 ++------- modules/gui/qt/widgets/qml/StackViewExt.qml | 21 ------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/modules/gui/qt/maininterface/qml/MainDisplay.qml b/modules/gui/qt/maininterface/qml/MainDisplay.qml index b3dc19e1cf7b..c1a5830e914b 100644 --- a/modules/gui/qt/maininterface/qml/MainDisplay.qml +++ b/modules/gui/qt/maininterface/qml/MainDisplay.qml @@ -267,18 +267,12 @@ FocusScope { anchors.fill: parent anchors.rightMargin: (playlistLoader.shown && !VLCStyle.isScreenSmall) ? playlistLoader.width - : 0 + : VLCStyle.applicationHorizontalMargin anchors.bottomMargin: g_mainDisplay.displayMargin + anchors.leftMargin: VLCStyle.applicationHorizontalMargin pageModel: g_mainDisplay.pageModel - leftPadding: VLCStyle.applicationHorizontalMargin - - rightPadding: playlistLoader.shown - ? 0 - : VLCStyle.applicationHorizontalMargin - - Navigation.parentItem: mainColumn Navigation.upItem: sourcesBanner Navigation.rightItem: playlistLoader diff --git a/modules/gui/qt/widgets/qml/StackViewExt.qml b/modules/gui/qt/widgets/qml/StackViewExt.qml index 8ec7129f9d7c..5b01937256bb 100644 --- a/modules/gui/qt/widgets/qml/StackViewExt.qml +++ b/modules/gui/qt/widgets/qml/StackViewExt.qml @@ -48,25 +48,4 @@ StackView { Accessible.ignored: true // Events - - onCurrentItemChanged: { - if (currentItem === null) - return - - // NOTE: When the currentItem has a padding defined we propagate the StackView values. - - if (currentItem.leftPadding !== undefined) - { - currentItem.leftPadding = Qt.binding(function() { - return leftPadding - }) - } - - if (currentItem.rightPadding !== undefined) - { - currentItem.rightPadding = Qt.binding(function() { - return rightPadding - }) - } - } } -- GitLab