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

[Mac] LeaveEvent sometimes missing when there is a tooltip

    XMLWordPrintable

Details

    • macOS

    Description

      In some cases (I could not find a 100% deterministic way to reproduce the bug), the leaveEvent will not be delivered on a widget if that widget has a custom tooltip. This result in the tooltip still being displayed, and the "hover" state stylesheet being active on the main widget.

       

      We have one widget (say, a QLabel) that wants to display a custom tooltip on EnterEvent, and hide it on LeaveEvent.

      Sometimes, the LeaveEvent is not received. This results in the Tooltip still being displayed, but also on the "hover" state to remain in the Label looks.

      An example for the classes of such a label and custom tooltip are in the attached files.

      Then the issue can be reproduced by adding a dozen of LabelWithToolTip in any layout, with the stylesheet 

      "LabelWithTooltip:hover {background-color: #FF0000;}"

       and quickly passing the mouse cursor over them. Not all of them are going to display the issue, but on the dozens of labels, some are likely to keep their tooltip and hover state.

      The tooltip does get a leaveEvent though. It's just that the parent label never gets one. So the issue of the tooltip still being displayed is easy enough to fix, by adding an eventFilter on the tooltip, to catch when that widget gets a leaveEvent. But there is not easy way to end the "hover" state.

      This only seems to happen on Mac. We could not reproduce the issue on Windows.

      Attachments

        1. code.cpp
          2 kB
        2. code.h
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            andeol Andéol Evain
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes