Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-109861

Press event can not be accepted by MouseArea when it covers a Button

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.2, 6.5.0 Beta1
    • None
    • macOS, Windows

    Description

      Steps to reproduce

      1. Load QML code into QQuickView where MouseArea covers a Button

      import QtQuick 2.0
      import QtQuick.Controls 2.0
      
      Item {
          width: 200; height: 200
          Button {
              anchors.fill: parent
          }
          MouseArea {
              id: ma
              anchors.fill: parent
              onPressed: mouse => mouse.accepted = true
          }
      } 

      2. Send a MouseButtonPress event into that QQuickView.

      Actual result
      MouseButtonPress event is NOT accepted.

      Expected result
      MouseButtonPress event is accepted.

      Additional info

      Removing a Button allows MouseArea to accept the event.
      Attached a code snippet for qtdeclarative/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp to illustrate the bug.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            igor.kulaychuk Igor K
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes