QApplication: Remove code duplication
We always send mouse move events through the application event filters even if the widget has no mouse tracking enabled. This code portion is an almost verbatim copy of QCoreApplicationPrivate::sendThroughApplicationEventFilters(). The only difference is that previously the filter and the widget had to be in the same thread. Now, we compare the filter's thread to the application's. This is without consequence since widgets must live in the application thread. Change-Id: Ifee9c041e06d80ea0c2d2a947231e58ee4dfa24d Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
e623453592
commit
e6d23860f0
@ -3182,17 +3182,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
|
||||
if (!w->hasMouseTracking()
|
||||
&& mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) {
|
||||
// but still send them through all application event filters (normally done by notify_helper)
|
||||
for (int i = 0; d->extraData && i < d->extraData->eventFilters.size(); ++i) {
|
||||
QObject *obj = d->extraData->eventFilters.at(i);
|
||||
if (!obj)
|
||||
continue;
|
||||
if (Q_UNLIKELY(obj->d_func()->threadData != w->d_func()->threadData)) {
|
||||
qWarning("QApplication: Object event filter cannot be in a different thread.");
|
||||
continue;
|
||||
}
|
||||
if (obj->eventFilter(w, w == receiver ? mouse : &me))
|
||||
break;
|
||||
}
|
||||
d->sendThroughApplicationEventFilters(w, w == receiver ? mouse : &me);
|
||||
res = true;
|
||||
} else {
|
||||
w->setAttribute(Qt::WA_NoMouseReplay, false);
|
||||
|
Loading…
Reference in New Issue
Block a user