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

QApplicationPrivate::mouse_buttons was in a wrong state after dnd operation

    XMLWordPrintable

Details

    Description

      ApplicationPrivate::mouse_buttons is the variable which track the system mouse button state. it will be updated when spontaneous QEvent::MouseButtonPress and QEvent::MouseButtonRelease event is sent to Qt. During a dnd operation, only the QEvent::MouseButtonPress is sent to Qt, and it will set Qt::LeftButton flag in QApplicationPrivate::mouse_buttons,but the QEvent::MouseButtonRelease event was never sent to Qt after the dnd operation ( it was eat by window system), this will leave QApplicationPrivate::mouse_buttons in a wrong state.
      In general, this will not cause any problem, because the next mouse click by user will correct the state in QApplicationPrivate::mouse_buttons. But I have encountered an anoying issue caused by this problem:
      After a dnd operation I created a child tool button widget in the widget who receive the drop, and the mouse pointer is in the rectangle of the child tool button widget, and when Qt call setVisible() for the child tool button widget it will call a funtion called QApplicationPrivate::sendSyntheticEnterLeave(), this function will simulate mouse enter/move/leave for the widget under the mouse pointer and it will use QApplicationPrivate::mouse_buttons to construct the QMouseEvent object, but at this time the QApplicationPrivate::mouse_buttons is in a wrong state, it will finally cause the child tool button widget repaint itself as in a pressed down state which looks obviously wrong.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            jianliang79 liang jian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes