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. Flickable below an item still scrolling
Forum Updated to NodeBB v4.3 + New Features

Flickable below an item still scrolling

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.0k Views 1 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.
  • N Offline
    N Offline
    ntadej
    wrote on last edited by
    #1

    I have a Qt use case, where I draw a semi-transparent overlay over a Flickable (for example GridView). If I scroll the mouse over the overlay, I would like flickable below not to scroll. Is there a simple way to achieve that (not do disable and enable flickable each time I hide/show overlay)?

    Example code:
    @import QtQuick 2.1

    Rectangle {
    width: 360
    height: 360

    Flickable {
        anchors.fill: parent
        contentWidth: 360
        contentHeight: 500
    
        Rectangle {
            width: 360
            height: 500
    
            Rectangle {
                anchors.centerIn: parent
                color:"red"
                width: 360
                height: 10
            }
        }
    }
    
    Rectangle {
        anchors.fill: parent
        color: "#99000000"
    }
    

    }

    @

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      If I understood you correctly you could set "interactive":http://doc.qt.io/qt-5/qml-qtquick-flickable.html#interactive-prop when you dont want to scroll.

      157

      1 Reply Last reply
      0
      • N Offline
        N Offline
        ntadej
        wrote on last edited by
        #3

        I know that, I was wondering if there is a more general way to catch all mouse events using one Item and don't pass them through to items below.

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Well since that semi transparent rect is your overlay you can define a MouseArea for it and then accept all the wheel events thus stopping it from propagating.
          @
          Rectangle {
          anchors.fill: parent
          color: "#99000000"

          MouseArea {
              anchors.fill: parent
              onWheel: wheel.accepted = true
          }
          

          }
          @

          157

          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