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. Scroll bar not responding to clicks
Forum Updated to NodeBB v4.3 + New Features

Scroll bar not responding to clicks

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 962 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 Qt Quick Controls 2 app, and have a ScrollView with a custom ScrollBar that isn't responding to clicks. It works as expected using gestures, but for some reason click and dragging the scroll them doesn't work. The problem happens under 5.10 and 5.11

    Here's a demo app that demonstrates the problem:

    import QtQuick 2.11
    import QtQuick.Window 2.11
    import QtQuick.Layouts 1.3
    import QtQuick.Controls 2.4
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        ScrollView{
            id: settingsScrollView
            contentHeight: 1200
            anchors.top:parent.top
            anchors.bottom:parent.bottom
            anchors.left:parent.left
            width:320
    
    
            ScrollBar.vertical: ScrollBar{
                anchors.top: parent.top
                anchors.right: parent.right
                //anchors.rightMargin: 10   //uncommenting this will allow scroll thumb to be controlled by click and drag
                anchors.bottom: parent.bottom
                width: 10
                contentItem: Rectangle{
                    color: "black"
                }
            }
    
            Column{
                //anchors.fill:parent
                width:320
                height:childrenRect.height
                Rectangle { color: "red"; width: parent.width; height: 300 }
                Rectangle { color: "green"; width: parent.width; height: 300 }
                Rectangle { color: "blue"; width: parent.width; height: 300 }
            }
    
        }
    }
    
    

    Any ideas what is happening here? Is there a work-round?

    B 1 Reply Last reply
    0
    • B Bernd B

      Use Flickable and clip: true

      Window {
      visible: true
      width: 640
      height: 480
      title: qsTr("Hello World")

      Flickable {  //change 
           clip: true // change
          id: settingsScrollView
          contentHeight: 1200
          anchors.top:parent.top
          anchors.bottom:parent.bottom
          anchors.left:parent.left
          width:320
      
      
          ScrollBar.vertical: ScrollBar{
              anchors.top: parent.top
              anchors.right: parent.right
              //anchors.rightMargin: 10   //uncommenting this will allow scroll thumb to be controlled by click and drag
              anchors.bottom: parent.bottom
              width: 10
              contentItem: Rectangle{
                  color: "black"
              }
          }
      
          Column{
              //anchors.fill:parent
              width:320
              height:childrenRect.height
              Rectangle { color: "red"; width: parent.width; height: 300 }
              Rectangle { color: "green"; width: parent.width; height: 300 }
              Rectangle { color: "blue"; width: parent.width; height: 300 }
          }
      
      }
      

      }

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

      @Bernd-B Thanks for the work-around!

      This definitely looks like a bug in ScrollView....

      1 Reply Last reply
      0
      • I igor_stravinsky

        I'm working on a Qt Quick Controls 2 app, and have a ScrollView with a custom ScrollBar that isn't responding to clicks. It works as expected using gestures, but for some reason click and dragging the scroll them doesn't work. The problem happens under 5.10 and 5.11

        Here's a demo app that demonstrates the problem:

        import QtQuick 2.11
        import QtQuick.Window 2.11
        import QtQuick.Layouts 1.3
        import QtQuick.Controls 2.4
        
        Window {
            visible: true
            width: 640
            height: 480
            title: qsTr("Hello World")
        
            ScrollView{
                id: settingsScrollView
                contentHeight: 1200
                anchors.top:parent.top
                anchors.bottom:parent.bottom
                anchors.left:parent.left
                width:320
        
        
                ScrollBar.vertical: ScrollBar{
                    anchors.top: parent.top
                    anchors.right: parent.right
                    //anchors.rightMargin: 10   //uncommenting this will allow scroll thumb to be controlled by click and drag
                    anchors.bottom: parent.bottom
                    width: 10
                    contentItem: Rectangle{
                        color: "black"
                    }
                }
        
                Column{
                    //anchors.fill:parent
                    width:320
                    height:childrenRect.height
                    Rectangle { color: "red"; width: parent.width; height: 300 }
                    Rectangle { color: "green"; width: parent.width; height: 300 }
                    Rectangle { color: "blue"; width: parent.width; height: 300 }
                }
        
            }
        }
        
        

        Any ideas what is happening here? Is there a work-round?

        B Offline
        B Offline
        Bernd B
        wrote on last edited by
        #2

        Use Flickable and clip: true

        Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")

        Flickable {  //change 
             clip: true // change
            id: settingsScrollView
            contentHeight: 1200
            anchors.top:parent.top
            anchors.bottom:parent.bottom
            anchors.left:parent.left
            width:320
        
        
            ScrollBar.vertical: ScrollBar{
                anchors.top: parent.top
                anchors.right: parent.right
                //anchors.rightMargin: 10   //uncommenting this will allow scroll thumb to be controlled by click and drag
                anchors.bottom: parent.bottom
                width: 10
                contentItem: Rectangle{
                    color: "black"
                }
            }
        
            Column{
                //anchors.fill:parent
                width:320
                height:childrenRect.height
                Rectangle { color: "red"; width: parent.width; height: 300 }
                Rectangle { color: "green"; width: parent.width; height: 300 }
                Rectangle { color: "blue"; width: parent.width; height: 300 }
            }
        
        }
        

        }

        I 1 Reply Last reply
        0
        • B Bernd B

          Use Flickable and clip: true

          Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")

          Flickable {  //change 
               clip: true // change
              id: settingsScrollView
              contentHeight: 1200
              anchors.top:parent.top
              anchors.bottom:parent.bottom
              anchors.left:parent.left
              width:320
          
          
              ScrollBar.vertical: ScrollBar{
                  anchors.top: parent.top
                  anchors.right: parent.right
                  //anchors.rightMargin: 10   //uncommenting this will allow scroll thumb to be controlled by click and drag
                  anchors.bottom: parent.bottom
                  width: 10
                  contentItem: Rectangle{
                      color: "black"
                  }
              }
          
              Column{
                  //anchors.fill:parent
                  width:320
                  height:childrenRect.height
                  Rectangle { color: "red"; width: parent.width; height: 300 }
                  Rectangle { color: "green"; width: parent.width; height: 300 }
                  Rectangle { color: "blue"; width: parent.width; height: 300 }
              }
          
          }
          

          }

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

          @Bernd-B Thanks for the work-around!

          This definitely looks like a bug in ScrollView....

          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