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

Property "visible" of QML Item seems to affect how mouse event is delivered

    XMLWordPrintable

Details

    • Windows
    • c36c6881c (dev), ef1dc2a9c (6.8), b4b3476e1 (tqtc/lts-6.5)

    Description

      Reproducer attached. problem seen with both 6.5.6 and 6.7.2 on Windows (not yet tested on other platforms). Steps to reproduce:
      1. Upon launching, "Page 1" of StackLayout is shown. Clicking inside TextField brings up the virtual keyboard. Meanwhile, a purple MouseArea is shown due to flag "screenCoverFlg" change. Clicking on that will defocus TextField and virtual keyboard will be gone. Purple MouseArea will also be invisible.
      2. Click "Page 2" button to switch to page 2. Clicking the Button to open up a Popup that has a TextField in it. Then the same thing in step #1 happens here: one can click and type something in TextField, and clicking on purple MouseArea closes everything (Although, clicking on anywhere outside Popup will do the same. Nevertheless, clicking onto MouseArea causes the problem in the following step)
      3. Switch back to Page 1 and do the same thing in step #1. But this time, clicking onto purple MouseArea does not do anything.

      Reason:
      Based on the log of event filter I installed, in step 3, press event is delivered to MouseArea, but release event is not (it is somehow stops at ApplicationWindow and not passed down). Then of course it is not considered as a click.

      Workaround:
      Replace "visible: screenCoverFlg" of MouseArea with either "opacity: screenCoverFlg" or "enabled: screenCoverFlg". Then mouse click works in step 3.

      In short, the seemingly buggy behavior is that "visible" seems to affect how mouse event is handled. Not sure if it is related to:
      https://doc.qt.io/qt-6/qml-qtquick-item.html#visible-prop
      i.e. "Because of this flow-on behavior, using the visible property may not have the intended effect if a property binding should only respond to explicit property changes. In such cases it may be better to use the opacity property instead". But judging from the description in doc, I don't see how this can affect release event delivering.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-128577
          # Subject Branch Project Status CR V

          Activity

            People

              srutledg Shawn Rutledge
              luqiaochen Luqiao Chen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes