If the style sets a padding this is not respected if we set anchors.fill: parent.
BUG: 407643
If the style sets a padding this is not respected if we set anchors.fill: parent.
BUG: 407643
Before:
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
An alternative approach could be to set the respective anchor.*margin to view.parent.*padding.
So the alternative approach would be something like this:
diff --git a/src/qmlcontrols/kcmcontrols/qml/ScrollView.qml b/src/qmlcontrols/kcmcontrols/qml/ScrollView.qml index 8ef57a2..443f063 100644 --- a/src/qmlcontrols/kcmcontrols/qml/ScrollView.qml +++ b/src/qmlcontrols/kcmcontrols/qml/ScrollView.qml @@ -48,14 +48,28 @@ QtControls.ScrollView { onViewChanged: { view.parent = scroll; view.anchors.fill = view.parent; + setMargins(); } activeFocusOnTab: false Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false - Component.onCompleted: scroll.background.visible = true; + Component.onCompleted: { + scroll.background.visible = true; + setMargins(); + } + + function setMargins() { + if (view.parent.padding) { + view.anchors.padding = view.parent.padding; + } else { + view.anchors.topMargin = view.parent.topPadding; + view.anchors.leftMargin = view.parent.leftPadding; + view.anchors.bottomMargin = view.parent.bottomPadding; + view.anchors.rightMargin = view.parent.rightPadding; + } + } - QtControls.ScrollBar.horizontal.visible: false }
I has the same result but maybe would be more correct?
This looks like a sane and simpler implementation to me, but let's get @mart's opinion too.