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

Hover is not reset properly with touchscreens

    XMLWordPrintable

Details

    • Linux/X11

    Description

      1. Create a button
      2. Use the touch screen to tap the button

      When the touch is over, the button is still in Hover state

      By setting the WA_Hover property in style, you can control whether the Widget needs Hover events and status. But this is not a good solution for devices where touch screen and mouse exist at the same time

      In SendMouseEvent, you can judge whether the mouse source comes from the system, and decide whether to send Enter Leave event, so as to control whether the Widget needs Hover event and status.
      Is this reasonable?

       

       

      --- a/src/widgets/kernel/qapplication.cpp
      +++ b/src/widgets/kernel/qapplication.cpp
      @@ -2365,7 +2365,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
                   if (event->type() == QEvent::MouseButtonRelease && !event->buttons())
                       *buttonDown = nullptr;
               }
      -    } else if (lastMouseReceiver && widgetUnderMouse) {
      +    } else if (lastMouseReceiver && widgetUnderMouse && event->source() == Qt::MouseEventSynthesizedBySystem) {
               // Dispatch enter/leave if we move:
               // 1) from an alien widget to another alien widget or
               //    from a native widget to an alien widget (first OR case)
      
      

       

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            tanghaixiang haixiang tang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes