D6246: Don't rely on QQuickWindow delivering QEvent::Ungrab as mouseUngrabEvent (as it no longer does in Qt 5.8+)

Eike Hein noreply at phabricator.kde.org
Sat Jun 17 03:24:14 UTC 2017


hein created this revision.
Restricted Application added projects: Plasma, Frameworks.
Restricted Application added a subscriber: Frameworks.

REVISION SUMMARY
  QQuickWindow::sendEvent in Qt 5.7 and older had the following code
  to deliver QEvent::UngrabMouse by calling QQuickItem::mouseUngrabEvent:
  
  case QEvent::UngrabMouse: {
  
        QSet<QQuickItem *> hasFiltered;
        if (!d->sendFilteredMouseEvent(item->parentItem(), item, e, &hasFiltered)) {
            e->accept();
            item->mouseUngrabEvent();
        }
    }
  
  This is gone from Qt 5.8+. While QEvent::Ungrab is still delivered to
  items, QQuickItem::mouseUngrabEvent is only called under constrained
  circumstances elsewhere, e.g. when ending an actual mouse grab held by
  an item and tracked by Qt.
  
  MouseEventListener relied on mouseUngrabEvent being called to implement
  something akin to MouseArea::canceled: Signaling a user it should clean
  up state after a press event, instead of, say, assuming the button is
  still held and waiting around for a release event. While QEvent::Ungrab
  was already being intercepted as well, it was only done for event de-
  duplication, not used for the above.
  
  This changes the code so handleUngrab checks first whether we're
  actually in press state (to make it safe to call repeatedly) and then
  call it from both the generic event handler and mouseUngrabEvent. This
  makes it work again with newer Qts.
  
  We rely on this particularly in the desktop containment, where we use
  EventGenerator from this same lib to deliver QEvent::Ungrab to applets
  when the containment goes into applet move mode on press-and-hold.
  Without MouseEventListener emiting canceled in response, e.g. moving
  a Folder View applet will e.g. put it into rectangle selection mode
  unwanted.
  BUG:380354

REPOSITORY
  R296 KDeclarative

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D6246

AFFECTED FILES
  src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp

To: hein, #plasma
Cc: plasma-devel, #frameworks, ZrenBot, spstarr, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170617/c85985ac/attachment.html>


More information about the Plasma-devel mailing list