Skip to content

Add default vertical scrollbar to TableView#45

Open
AndrewSazonov wants to merge 2 commits intodevelopfrom
scrollbar_tableview
Open

Add default vertical scrollbar to TableView#45
AndrewSazonov wants to merge 2 commits intodevelopfrom
scrollbar_tableview

Conversation

@AndrewSazonov
Copy link
Copy Markdown
Member

This PR adds the existing EaElements.ScrollBar as the default vertical scrollbar for TableView with AsNeeded policy and interactive behavior enabled.

@AndrewSazonov AndrewSazonov requested a review from seventil April 22, 2026 12:05
@AndrewSazonov AndrewSazonov added the [scope] enhancement Adds/improves features (major.MINOR.patch) label Apr 22, 2026
Copy link
Copy Markdown

@seventil seventil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add topInset and topPadding to the ScrollBar if you want to ofset height for the header.
I guess with AsNeeded policy user only sees a narrow indicator-like bar anyway, and they can interact with it if they want, so it's totally OK to define interactive:true.

Here's an example from listview just for reference:

property real _headerHeight: headerItem ? headerItem.height : 0
ScrollBar.vertical: EaElements.ScrollBar {
        policy: listView.scrollBarPolicy
        interactive: listView.scrollBarInteractive
        topInset: listView._headerHeight
        topPadding: listView._headerHeight
    }

@AndrewSazonov AndrewSazonov added the [priority] high Should be prioritized soon label Apr 23, 2026
@AndrewSazonov
Copy link
Copy Markdown
Member Author

Right, I forgot about this, thanks for pointing it out.

I would avoid adding an extra _headerHeight QML property unless it is really needed, since every QML property also adds the associated signal/slot machinery. In this case the value is only used by the scrollbar, so keeping it inline is simpler.

Also, I used listView.headerItem instead of just headerItem to make it clearer that the height comes from the parent ListView.

ScrollBar.vertical: EaElements.ScrollBar {
    topInset: listView.headerItem ? listView.headerItem.height : 0
    topPadding: topInset

    interactive: true
    policy: ScrollBar.AsNeeded
}

@AndrewSazonov AndrewSazonov self-assigned this Apr 23, 2026
Copy link
Copy Markdown

@seventil seventil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] high Should be prioritized soon [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants