summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-02-17 15:12:40 -0800
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-02-24 19:51:54 +0000
commite6d23860f08f59caa131bae8ca90f9e36e4dc033 (patch)
tree0e021c94139faebaa07b35cef89f8ed5672457d5 /src/widgets/kernel/qapplication.cpp
parente6234535929c67e7fbfa1ad7ce88f37df0b68d45 (diff)
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>
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r--src/widgets/kernel/qapplication.cpp12
1 files changed, 1 insertions, 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);