D22827: Scrollview - Don't fill the parent with the view

David Redondo noreply at phabricator.kde.org
Thu Aug 1 09:36:23 BST 2019


davidre added a comment.


  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?

REPOSITORY
  R296 KDeclarative

REVISION DETAIL
  https://phabricator.kde.org/D22827

To: davidre, mart
Cc: filipf, kde-frameworks-devel, LeGast00n, sbergeron, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190801/2ff7b0dd/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list