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. Scrollview wheel problem

Scrollview wheel problem

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 Posters 828 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.
  • jondoeJ Offline
    jondoeJ Offline
    jondoe
    wrote on last edited by jondoe
    #1

    Hello,
    I have gridview and rectangle in scrollview.
    I can scroll when my mouse on gridview but i cant scroll when my mouse on rectangle.
    How can i fix this problem ?

    NOT
    Scroll i mean this not working on rectangle http://prntscr.com/ont7eb

    Black area is - Scrollview
    Red area is - Gridview
    Green area is - Rectangle
    Grey area is - Scroll
    https://prnt.sc/ooj2rh

    And trying to do something like this
    https://miro.medium.com/max/1000/1*yZugJe-acCtHX7e2r71YKw.gif
    Just i have on left side gridview and right side rectangles

    Codes
    https://pastebin.com/uH9DWq3G

    jondoeJ 1 Reply Last reply
    0
    • jondoeJ jondoe

      Hello,
      I have gridview and rectangle in scrollview.
      I can scroll when my mouse on gridview but i cant scroll when my mouse on rectangle.
      How can i fix this problem ?

      NOT
      Scroll i mean this not working on rectangle http://prntscr.com/ont7eb

      Black area is - Scrollview
      Red area is - Gridview
      Green area is - Rectangle
      Grey area is - Scroll
      https://prnt.sc/ooj2rh

      And trying to do something like this
      https://miro.medium.com/max/1000/1*yZugJe-acCtHX7e2r71YKw.gif
      Just i have on left side gridview and right side rectangles

      Codes
      https://pastebin.com/uH9DWq3G

      jondoeJ Offline
      jondoeJ Offline
      jondoe
      wrote on last edited by
      #2

      Help pls

      1 Reply Last reply
      0
      • IntruderExcluderI Offline
        IntruderExcluderI Offline
        IntruderExcluder
        wrote on last edited by IntruderExcluder
        #3

        Your example is very complicated. I can't understand what rectangle are you talking about, there are too many rectangles. So, my first question is: why do you use ScrollView with GridView? GridView is already a flickable element and supports scrolling out of box.

        jondoeJ 1 Reply Last reply
        1
        • IntruderExcluderI IntruderExcluder

          Your example is very complicated. I can't understand what rectangle are you talking about, there are too many rectangles. So, my first question is: why do you use ScrollView with GridView? GridView is already a flickable element and supports scrolling out of box.

          jondoeJ Offline
          jondoeJ Offline
          jondoe
          wrote on last edited by jondoe
          #4

          @intruderexcluder I trying to do scroll on all content. When i going down with scroll i want scroll all page not just gridview. I know gridview also flickable but then rectangles not moving. I updated my thread and added picture can u check please. https://prnt.sc/ooj2rh

          And trying to do something like this https://miro.medium.com/max/1000/1*yZugJe-acCtHX7e2r71YKw.gif
          Just i have on left side gridview and right side rectangles

          1 Reply Last reply
          0
          • IntruderExcluderI Offline
            IntruderExcluderI Offline
            IntruderExcluder
            wrote on last edited by IntruderExcluder
            #5

            Your code is a mess and I still cannot understand it. I wrote a small example of what you want:

                ScrollView {
                    id: sv
                    anchors.fill: parent
            
                    contentHeight: grid.contentHeight
            
                    Item {
                        width: parent.width * 0.5
                        height: parent.height
            
                        GridView {
                            id: grid
                            anchors.fill: parent
            
                            cellWidth:  100
                            cellHeight: 100
            
                            model: 123
            
                            delegate: Item {
                                width: GridView.view.cellWidth
                                height: GridView.view.cellHeight
            
                                Rectangle {
                                    anchors {
                                        fill: parent
                                        margins: 2
                                    }
                                    color: "plum"
            
                                    Text {
                                        anchors.centerIn: parent
                                        text: "Item %1".arg(model.index)
                                    }
                                }
                            }
                        }
                    }
            
                    Rectangle {
                        anchors {
                            top: parent.top; topMargin: 10
                            right: parent.right; rightMargin: 10
                        }
            
                        width: parent.width * 0.4
                        height: 200
                        color: "#424242"
                    }
                }
            

            But keep in mind that it is not good solution. In my case whole grid view stretched to its height. This means that all items will be created at start, which could cause a lot of memory consumption. The best way, probably, is to control scroll of grid view by some mouse wheel event and move contentY of grid view by yourself.

            jondoeJ 1 Reply Last reply
            1
            • IntruderExcluderI IntruderExcluder

              Your code is a mess and I still cannot understand it. I wrote a small example of what you want:

                  ScrollView {
                      id: sv
                      anchors.fill: parent
              
                      contentHeight: grid.contentHeight
              
                      Item {
                          width: parent.width * 0.5
                          height: parent.height
              
                          GridView {
                              id: grid
                              anchors.fill: parent
              
                              cellWidth:  100
                              cellHeight: 100
              
                              model: 123
              
                              delegate: Item {
                                  width: GridView.view.cellWidth
                                  height: GridView.view.cellHeight
              
                                  Rectangle {
                                      anchors {
                                          fill: parent
                                          margins: 2
                                      }
                                      color: "plum"
              
                                      Text {
                                          anchors.centerIn: parent
                                          text: "Item %1".arg(model.index)
                                      }
                                  }
                              }
                          }
                      }
              
                      Rectangle {
                          anchors {
                              top: parent.top; topMargin: 10
                              right: parent.right; rightMargin: 10
                          }
              
                          width: parent.width * 0.4
                          height: 200
                          color: "#424242"
                      }
                  }
              

              But keep in mind that it is not good solution. In my case whole grid view stretched to its height. This means that all items will be created at start, which could cause a lot of memory consumption. The best way, probably, is to control scroll of grid view by some mouse wheel event and move contentY of grid view by yourself.

              jondoeJ Offline
              jondoeJ Offline
              jondoe
              wrote on last edited by
              #6

              @intruderexcluder Worked!! Thank you so much for help!

              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