Problems with ScrollBar and ListView
-
I have a couple of problems when customizing a
ScrollBarin aListView. The first problem I have is that the bar is only ever visible when I am either: hovering the bar or scrolling the list. This makes it a poor indicator to the user that there is more content available then they can currently see in the list.In order to get around this I customize the bar a bit like so:
ScrollBar.vertical: ScrollBar { height: parent.height width: 30 policy: ScrollBar.AsNeeded contentItem: Rectangle { color: themeManager.currentTheme.palette.highlightColor radius: 5 opacity: 1 } rightPadding: 10 }This allows the bar to always be visible; however, that is a problem because I only want the bar to be visible when it is needed.
So, if I set the
visibleproperty of theRectanglelike so:visible: parent.activethen it will only show up when it's needed but I am back to the original problem...
Is there a way to have the bar be visible at all times when it is needed? Not just when I scroll the list or when I hover the bar but always but ONLY when it makes sense to actually have a scrollbar.
Essentially, what I need to figure out is how this
policyproperty works. That does seem to work correctly in that the scroll bar will only ever show up if it is needed but I can't set thevisibilityof mycontentItemto be "parent.whenparentisneeded" now can I..