1
votes

So, the QtQuick Scrollbar has a policy setting for AsNeeded, AlwaysOn and AlwaysOff. Unfortunately, with AsNeeded there is a core problem: The scrollbar only shows while mousing over the flickable it is attached to ( A ListView with CheckDelegates in my case).

This means by just looking at the menu, there might be more checkboxes the user does not see until they mouse over the ListView, which doesn't always happen.

AlwaysOn is also problematic, as it also shows when the ListView has fewer entries than the list is long and in that case the ScrollBar is just a confusing rectangle.

Is there a way to configure ScrollBar in such a way, that it always shows up, if there is something to scroll and make it not show up at all, when there isn't?

2

2 Answers

4
votes

You could do:

policy: listView.contentHeight > listView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff

This will always show the scrollbar when the content is too big to fit in the listview.

0
votes

You could also make the scrollbar visible when (qscrollbar property )size < 1.0 where size is actually the ration height/content. If you don't use an attached scroll bar you can set your own height.