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

[Reg 5.12.0 - 5.12.1][macos] Event filter receives only mouse press event when mouse click is created using native events

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.12.1
    • Fix Version/s: 5.12
    • Component/s: QPA
    • Environment:
      Tested on macOS 10.13 (High Sierra)
    • Platform/s:
      macOS

      Description

      To simulate mouse for test automation purposes mouse events are created with CGEventCreateMouseEvent(nullptr, eventType, p, kCGMouseButtonLeft), where eventType is either kCGEventLeftMouseDown or kCGEventLeftMouseUp. Then these events are posted to the event stream.

      Now, since Qt 5.12.1, only QEvent::MouseButtonPress events are caught in the event filter - no QEvent::MouseButtonRelease at all. This started to happen after https://codereview.qt-project.org/#/c/244627/. The fix patch introduces bool initialPress, which in this case is always 'false'.

      Reverting the above mentioned patch fixes the problem, but the patch isn't necessarily the root cause. 'initialPress' is 'false', because QMouseEvent::buttons() is 'NoButton' with MouseButtonPress event while according to documentation is should include the button causing the event. And in this case, if it did contain the button causing the event, 'initialPress' would be 'true' and mouse events would flow as expected.

      The attached example reproduces the problem. Press the bottom button to start automated mouse click simulation (for the 'Beep' button). See also statusBar message for received events.
      Expected result: Cursor moves to center of beepButton, button highlights on and off and there is a beep.
      Actual result: Cursor moves to center of beepButton and button highlights on and stays on until the user click on the 'Beep' button.

        Attachments

        1. qtbug73814.patch
          0.9 kB
        2. qtbug73814.tar.gz
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              vestbo Tor Arne Vestbø
              Reporter:
              qtcomsupport Qt Support
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes