Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Why is there a dead zone on the right side of my flipable?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    igor_stravinsky
    wrote on last edited by
    #1

    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
            }
    }
    }
    
    
    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leon_2001
      wrote on last edited by
      #2

      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
            }
          }
        }
      }
      
      1 Reply Last reply
      0
      • I Offline
        I Offline
        igor_stravinsky
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leon_2001
          wrote on last edited by Leon_2001
          #4

          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.

          I 1 Reply Last reply
          0
          • L Leon_2001

            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.

            I Offline
            I Offline
            igor_stravinsky
            wrote on last edited by
            #5

            @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.

            1 Reply Last reply
            0
            • I Offline
              I Offline
              igor_stravinsky
              wrote on last edited by
              #6

              It turned out that this was caused because the back side of the flippable has a drawer on it.

              The Drawer has a drag margin on the right side, and this margin corresponds to the dead zone on the right of all other views. In the case of the scroll bar, having it on the right side made it impossible to use the scroll thumbs to scroll the view.

              This has been logged as QTBUG-68748
              https://bugreports.qt.io/browse/QTBUG-68748

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved