Skip to content

ScrollView Padding #94

@Ansraer

Description

@Ansraer

ScrollView currently uses the following internally:

    flickable := Flickable {
        x: 0;
        y: 0;
        viewport_y <=> vertical_bar.value;
        viewport_x <=> horizontal_bar.value;
        width: root.width - root.scroll_bar_size - 2 * root.scroll_bar_padding;
        height: root.height - root.scroll_bar_size;

        @children
    }

The problem with this code is that it always adds some padding for the scroll bars, even when they are disabled. I fixed this issue with the following:

    flickable := Flickable {
        x: 0;
        y: 0;
        viewport_y <=> vertical_bar.value;
        viewport_x <=> horizontal_bar.value;
        width: root.vertical_scrollbar_policy == ScrollBarPolicy.always-off ? root.width : root.width - root.scroll_bar_size - 2 * root.scroll_bar_padding;
        height: root.horizontal_scrollbar_policy == ScrollBarPolicy.always-off ? root.height : root.height - root.scroll_bar_size;

        @children
    }

Also, is there a reason why only one scrollbar uses padding?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions