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

Mouse Area Scroll

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 5 Posters 875 Views 2 Watching
  • 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.
  • P Offline
    P Offline
    PixyWitchy
    wrote on last edited by
    #1

    Good morning,

    I was trying to use mouseArea onWheel to do some animation on scrolling but it doesn't seem to work. Can someone give me an example of scroll detection with mouseArea?

    Thank you,

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2
      MouseArea {
        acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.Wheel
        hoverEnabled: true
      
        onWheel: {
          // do some stuff here
        }
      }
      

      hoverEnabled might be unnecessary.

      (Z(:^

      ODБOïO 1 Reply Last reply
      2
      • sierdzioS sierdzio
        MouseArea {
          acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.Wheel
          hoverEnabled: true
        
          onWheel: {
            // do some stuff here
          }
        }
        

        hoverEnabled might be unnecessary.

        ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by ODБOï
        #3

        @sierdzio said in Mouse Area Scroll:

        hoverEnabled might be unnecessary.

        acceptedButtons also

        1 Reply Last reply
        0
        • Shrinidhi UpadhyayaS Offline
          Shrinidhi UpadhyayaS Offline
          Shrinidhi Upadhyaya
          wrote on last edited by
          #4

          Hi @PixyWitchy , can you tell us more like which item you are using like Flickable,ListView,ScrollView etc.

          And can you show us a sample example or code like what is expected UI and behavior.

          Note:- Have a look once,Flickable[https://doc.qt.io/qt-5/qml-qtquick-flickable.html#dragging-prop]

          Shrinidhi Upadhyaya.
          Upvote the answer(s) that helped you to solve the issue.

          P 1 Reply Last reply
          0
          • Shrinidhi UpadhyayaS Shrinidhi Upadhyaya

            Hi @PixyWitchy , can you tell us more like which item you are using like Flickable,ListView,ScrollView etc.

            And can you show us a sample example or code like what is expected UI and behavior.

            Note:- Have a look once,Flickable[https://doc.qt.io/qt-5/qml-qtquick-flickable.html#dragging-prop]

            P Offline
            P Offline
            PixyWitchy
            wrote on last edited by
            #5

            @Shrinidhi-Upadhyaya this groupbox is inside a dialog and i use a repeater to create some data

            GroupBox {
                            id: groupBox
                            title: multiSelectorDialog.message
                            property var initSize: 0
                            Layout.minimumWidth: 150
            
                            Column {
                                id: columnBox
                                spacing: 10
                                Layout.fillWidth: true
            
                                MouseArea {
                                    anchors.fill: parent
                                    scrollGestureEnabled: true
                                    onWheel: {
                                        console.log("whee-whee")
                                    }
                                }
                                // the Repeater will create all the checkbox using the c++ model
                                Repeater {
                                    id: checkboxList
            
                                    model: multiSelectorModel
                                    CheckBox {
                                        text: textOption
                                        checked: check
                                    }
                                }
                            }
                            onHeightChanged: window.height = dialog.height + height
                            onWidthChanged: {
                                // to get responsive size
                                if (window.width == 0)
                                {
                                    initSize = width
                                }
                                window.width = width + initSize + dialog.leftMargin + dialog.leftPadding
                            }
                        }
            
            1 Reply Last reply
            0
            • IntruderExcluderI Offline
              IntruderExcluderI Offline
              IntruderExcluder
              wrote on last edited by
              #6

              Flickable is what you need. Simple example with GroupBox and scrollable content (20 default checkboxes):

                  GroupBox {
                      id: gb
                      width: 200
                      height: 200
                      title: "Some Title"
              
                      Flickable {
                          anchors.fill: parent
              
                          contentWidth: width
                          contentHeight: column.implicitHeight
                          clip: true
              
                          Column {
                              id: column
                              width: parent.width
              
                              Repeater {
                                  visible: false
                                  model: 20
                                  delegate: CheckBox {
                                      width: gb.width
                                      text: "CheckBox %1".arg(model.index)
                                  }
                              }
                          }
                      }
                  }
              
              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