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
Forum Updated to NodeBB v4.3 + New Features

Scrollview wheel problem

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 Posters 845 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.
  • J Offline
    J Offline
    jondoe
    wrote on 3 Aug 2019, 10:20 last edited by jondoe 8 May 2019, 11:19
    #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

    J 1 Reply Last reply 3 Aug 2019, 18:03
    0
    • J jondoe
      3 Aug 2019, 10:20

      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

      J Offline
      J Offline
      jondoe
      wrote on 3 Aug 2019, 18:03 last edited by
      #2

      Help pls

      1 Reply Last reply
      0
      • I Offline
        I Offline
        IntruderExcluder
        wrote on 5 Aug 2019, 08:56 last edited by IntruderExcluder 8 May 2019, 08:56
        #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.

        J 1 Reply Last reply 5 Aug 2019, 11:15
        1
        • I IntruderExcluder
          5 Aug 2019, 08:56

          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.

          J Offline
          J Offline
          jondoe
          wrote on 5 Aug 2019, 11:15 last edited by jondoe 8 May 2019, 11:19
          #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
          • I Offline
            I Offline
            IntruderExcluder
            wrote on 5 Aug 2019, 12:36 last edited by IntruderExcluder 8 May 2019, 12:37
            #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.

            J 1 Reply Last reply 5 Aug 2019, 13:06
            1
            • I IntruderExcluder
              5 Aug 2019, 12:36

              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.

              J Offline
              J Offline
              jondoe
              wrote on 5 Aug 2019, 13:06 last edited by
              #6

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

              1 Reply Last reply
              0

              2/6

              3 Aug 2019, 18:03

              topic:navigator.unread, 4
              • Login

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