[Interest] Qt Quick ScrollView scrollbar visibiltiy

Ian Monroe ian at monroe.nu
Thu Jun 19 20:08:56 CEST 2014


On Thu, Jun 19, 2014 at 10:59 AM, Alex Montgomery
<apmontgomery at gmail.com> wrote:
> Hello,
>
> I am trying to position an item in a ScrollView such that it doesn't move
> when the vertical scrollbar appears. Basically, I want to leave exactly
> enough room on the right side of the ScrollView for the scrollbar to appear
> without adjusting the contents size.  Is this possible? I can't figure out
> how to determine if a scrollbar is being drawn at a given time, let alone
> figure out how wide it is!
>

I have a border that only shows up when the scrollbar is not visible:

            Rectangle {
                width: 1
                height: parent.height
                color: borderColor
                anchors.right: parent.right
                anchors.top: parent.top
                visible: conversationView.width == scrollArea.width
            }
Where scollArea is the ScrollView and conversationView is a ListView
inside the ScrollView.

Seems like you could use similar logic to figure out what you need.

Ian



More information about the Interest mailing list