[Dialog] Don't forward hover event when there is nowhere to forward it to

Dialog has this clever way of re-sending a mouse event inside the bounardies of the dialog,
so despite visual padding, the items can be clicked on any corner following Fitt's law.
However, when the mainItem has no size, adjusting the position will adjust it inside the border
since there is no pixel inside the main item, leading to infinite recursion as the event is
processed again and again and again leading to a crash.

Differential Revision: https://phabricator.kde.org/D20200
This commit is contained in:
Kai Uwe Broulik 2019-04-02 14:04:37 +02:00
parent 9aa249e86a
commit 9de0def99f

View File

@ -1208,7 +1208,7 @@ bool Dialog::event(QEvent *event)
/*Fitt's law: if the containment has margins, and the mouse cursor clicked /*Fitt's law: if the containment has margins, and the mouse cursor clicked
* on the mouse edge, forward the click in the containment boundaries * on the mouse edge, forward the click in the containment boundaries
*/ */
if (d->mainItem) { if (d->mainItem && !d->mainItem->size().isEmpty()) {
switch (event->type()) { switch (event->type()) {
case QEvent::MouseMove: case QEvent::MouseMove:
case QEvent::MouseButtonPress: case QEvent::MouseButtonPress: