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

[Macintosh]left-click followed quickly by right-click generates bad events

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.0 Alpha, 5.12.0
    • Core: I/O
    • None
    • Mac OS X 10.10.3
      Qt 5.6 alpha, just downloaded and built here in the last few days
    • macOS

    Description

      If you left-click, then without releasing the mouse button, press the right button, then release, the left-click release isn't delivered. I have attached a runnable example.

      Run the example; it shows a window.
      If you right-click you get a contextual menu.
      if instead you depress the left button, then quickly depress the right button, then release, you still get the contextual menu.
      Now move the mouse pointer into the menu, highlighting an item. Move it out of the contextual menu. You may need to move in and out a few times. On moving out, the menu dismisses itself, and a mousePressEvent is delivered to the window.

      The attached example also uses qDebug() to print messages as mouse events are received. When I ran the example, using the recipe above, I got these messages:

      {{{
      mousePressEvent with buttons QFlags<Qt::MouseButtons>(LeftButton)   <===depressed left button
      mousePressEvent with buttons QFlags<Qt::MouseButtons>(LeftButton|RightButton)   <=== depressed right button
      **** Here I released the buttons, also quickly ****
      contextMenuEvent, application buttons QFlags<Qt::MouseButtons>(LeftButton|RightButton)   <=== message in contextMenuEvent handler
      *** Here I moved the mouse pointer into and back out of the menu ***
      No item chosen   <=== message from contextMenuEvent handler
      mousePressEvent with buttons QFlags<Qt::MouseButtons>(LeftButton)
      }}}
      

      Note that the last mousePressEvent isn't paired with a mouseReleaseEvent. also note that it does not correspond to an actual physical mouse press.

      The same code with the same sequence of mouse buttons gives these messages on Windows, where I don't see the problem:

      {{{
      mousePressEvent with buttons QFlags<Qt::MouseButtons>(LeftButton)
      mousePressEvent with buttons QFlags<Qt::MouseButtons>(LeftButton|RightButton)
      mouseReleaseEvent with buttons QFlags<Qt::MouseButtons>(RightButton)
      mouseReleaseEvent with buttons QFlags<Qt::MouseButtons>(NoButton)
      contextMenuEvent, application buttons QFlags<Qt::MouseButtons>(NoButton)
      No item chosen   <==== triggered by actually physically clicking outside the menu
      mousePressEvent with buttons QFlags<Qt::MouseButtons>(LeftButton)
      mouseReleaseEvent with buttons QFlags<Qt::MouseButtons>(NoButton)
      }}}
      

      Note that the events are nicely paired, press and release.

      Please forgive the lengthy and complicated post. It's hard to describe.

      Attachments

        Issue Links

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

          Activity

            People

              mikhailsvetkin Mikhail Svetkin
              johnweeks John Weeks
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes