<table><tr><td style="">hein created this revision.<br />Restricted Application added projects: Plasma, Frameworks.<br />Restricted Application added a subscriber: Frameworks.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D6246" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>QQuickWindow::sendEvent in Qt 5.7 and older had the following code<br />
to deliver QEvent::UngrabMouse by calling QQuickItem::mouseUngrabEvent:</p>
<p>case QEvent::UngrabMouse: {</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"> QSet<QQuickItem *> hasFiltered;
if (!d->sendFilteredMouseEvent(item->parentItem(), item, e, &hasFiltered)) {
e->accept();
item->mouseUngrabEvent();
}
}</pre></div>
<p>This is gone from Qt 5.8+. While QEvent::Ungrab is still delivered to<br />
items, QQuickItem::mouseUngrabEvent is only called under constrained<br />
circumstances elsewhere, e.g. when ending an actual mouse grab held by<br />
an item and tracked by Qt.</p>
<p>MouseEventListener relied on mouseUngrabEvent being called to implement<br />
something akin to MouseArea::canceled: Signaling a user it should clean<br />
up state after a press event, instead of, say, assuming the button is<br />
still held and waiting around for a release event. While QEvent::Ungrab<br />
was already being intercepted as well, it was only done for event de-<br />
duplication, not used for the above.</p>
<p>This changes the code so handleUngrab checks first whether we're<br />
actually in press state (to make it safe to call repeatedly) and then<br />
call it from both the generic event handler and mouseUngrabEvent. This<br />
makes it work again with newer Qts.</p>
<p>We rely on this particularly in the desktop containment, where we use<br />
EventGenerator from this same lib to deliver QEvent::Ungrab to applets<br />
when the containment goes into applet move mode on press-and-hold.<br />
Without MouseEventListener emiting canceled in response, e.g. moving<br />
a Folder View applet will e.g. put it into rectangle selection mode<br />
unwanted.<br />
BUG:380354</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R296 KDeclarative</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D6246" rel="noreferrer">https://phabricator.kde.org/D6246</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp</div></div></div><br /><div><strong>To: </strong>hein, Plasma<br /><strong>Cc: </strong>plasma-devel, Frameworks, ZrenBot, spstarr, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas<br /></div>