From e6d23860f08f59caa131bae8ca90f9e36e4dc033 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 17 Feb 2017 15:12:40 -0800 Subject: [PATCH] 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 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qapplication.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 2c85ed3c0b..0e4ee30c19 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -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);