Why is there a dead zone on the right side of my flipable?



  • I'm working on a simple Qt Quick Controls 2 app

    In it, I have a view which uses a ScrollView with a ScrollBar in it. When that's the only screen, the vertical scroll bar responds to gestures or when the I click on the scroll bar thumb and drag.

    If I put that same view inside of a Flipable, and make it the flipable's front view, the scroll bar on the right side of the view becomes unresponsive to being clicked. It still responds to gestures, however.

    Through trial and error, I discovered that if I move the scroll bar in 10 pixels from the right side of the window, the scroll bar behaves normally. The problem isn't limited to scroll bars, however. If I put a 10 pixel wide button on the right side of the screen in a Flipable, it can't be clicked on.

    What is happening here? Did I miss a bit of documentation that says that controls on the edges of Flipables aren't clickable? Is there some invisible border in a flipable that I can't see?

    My main window is pretty much copied and pasted from the qml example code. My front side view looks like this:

    Item {
        id:frontSide
        anchors.fill:parent
    
        ScrollView{
            id:frontScrollView
            anchors.fill:parent
            contentHeight: a_text.height
            contentWidth: a_text.width
    
            ScrollBar.vertical: ScrollBar{
                anchors.top: parent.top
                anchors.bottom:parent.bottom
                anchors.right:parent.right
                anchors.rightMargin: 10 //remove this, and the scroll bar won't be clickable
                policy: ScrollBar.AlwaysOn
    
            }
    
            Text{
                id:a_text
                text:"a"
                font.family: "helvetica"
                font.pointSize: 1000
            }
    }
    }
    
    


  • I am not an expert, but as you use ScrollView from Qt Quick Controls 2.x, Scrollbars are already attached to it. So you don't have to do this again.
    Nevertheless, you can still change properties of it. So if you wish to have it always on, just use ScrollBar.vertical.policy: ScrollBar.AlywaysOn

    import QtQuick.Controls 2.3
    import QtQuick 2.10
    
    ApplicationWindow {
      width: 500; height: 500
      visible: true
    
      Item {
        id:frontSide
        anchors.fill:parent
    
        ScrollView{
          id:frontScrollView
          anchors.fill:parent
          contentHeight: a_text.height
          contentWidth: a_text.width
    
          ScrollBar.vertical.policy: ScrollBar.AlwaysOn
    
          Text{
              id:a_text
              text:"a"
              font.family: "helvetica"
              font.pointSize: 1000
          }
        }
      }
    }
    


  • @Leon_2001 You're absolutely right about the ScrollBars inside of a ScrollView.

    I bracket them when I'm changing a lot of parameters, so I don't have to type ScrollBar.vertical.* over and over. If I were just changing the policy, I'd do it as you did.



  • I am not quite sure if you see your mistake? If you want to change a lot of parameters you still have to do it like this.

    ScrollBar.vertical {
      ...
    }
    

    instead of

    ScrollBar.vertical: ScrollBar {
    }
    

    Because in the second version you would attach a (new) scrollbar to a Flickable. But you haven't used a Flickable and ScrollView already provides two Scrollbars -> this also means, you don't have to position them.



  • @Leon_2001 Thanks for pointing that out!

    I was doing that in a simple example, my real project has scrollbars inside a ListView, where you do need to do

    ScrollBar.vertical: ScrollBar {
    }
    
    

    It's interesting that creating a new scroll bar in a ScrollView created the same issue. That must have put two scroll bars on top of each other, and the visible one wouldn't respond to clicks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.