diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2018-05-09 20:52:29 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2018-06-28 20:40:33 +0000 |
commit | dbcaa6d01ed6fd510f8b36bbe69fc1c9d8e21d88 (patch) | |
tree | 39b531e90e0d717562705db6ca68172b3e31d4f1 /src/widgets/kernel | |
parent | 5e39b832e23889af0a5d39586fd3ccf0b1882667 (diff) |
Tracepoints: add tracing for QEvents
Add tracepoints in all the main codepaths for event handling:
* QEvent ctors/dtor
* QCoreApplication::postEvent, sendEvent and sendSpontaneousEvent
* QCoreApplication / QApplication::notify, and around the handling
of event filters as well
I'm switching the name of the tracepoints themselves to have the
very same casing of the functions in Qt's own source code, this
improves readability a lot. The pre-existing ones will be changed
in an upcoming patch.
Change-Id: Iae2ba2bfdd76a82c85445bb5b86434e910427a70
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 5dae8a7a0d..581b7c9c94 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -110,6 +110,8 @@ #include <qpa/qplatformwindow.h> +#include <qtwidgets_tracepoints_p.h> + //#define ALIEN_DEBUG static void initResources() @@ -3707,11 +3709,19 @@ bool QApplication::notify(QObject *receiver, QEvent *e) bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) { + // These tracepoints (and the whole function, actually) are very similar + // to the ones in QCoreApplicationPrivate::notify_helper; the reason for their + // duplication is because tracepoint symbols are not exported by QtCore. + // If you adjust the tracepoints here, consider adjusting QCoreApplicationPrivate too. + Q_TRACE(QApplication_notify_entry, receiver, e, e->type()); + // send to all application event filters if (threadRequiresCoreApplication() && receiver->d_func()->threadData->thread == mainThread() - && sendThroughApplicationEventFilters(receiver, e)) + && sendThroughApplicationEventFilters(receiver, e)) { + Q_TRACE(QApplication_notify_event_filtered, receiver, e, e->type()); return true; + } if (receiver->isWidgetType()) { QWidget *widget = static_cast<QWidget *>(receiver); @@ -3731,11 +3741,18 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) } // send to all receiver event filters - if (sendThroughObjectEventFilters(receiver, e)) + if (sendThroughObjectEventFilters(receiver, e)) { + Q_TRACE(QApplication_notify_event_filtered, receiver, e, e->type()); return true; + } + + Q_TRACE(QApplication_notify_before_delivery, receiver, e, e->type()); // deliver the event - bool consumed = receiver->event(e); + const bool consumed = receiver->event(e); + + Q_TRACE(QApplication_notify_after_delivery, receiver, e, e->type(), consumed); + QCoreApplicationPrivate::setEventSpontaneous(e, false); return consumed; } |