diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-03 12:26:08 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-04 08:02:12 +0200 |
commit | 761f88f8baa23fab70ed5e96d6344bef6e2aca94 (patch) | |
tree | 836a58b39b9d40fed1358896a67a7ff248e0f098 /tests/manual/diaglib/eventfilter.h | |
parent | 224a60989ed95e8b91ac88a12666af6e5a66e619 (diff) |
Diaglib: Improve formatting of DebugProxyStyle
The class used the default debug operator for QObject, which outputs
the object's address. This makes it hard to compare the log output.
Make the existing QObject formatting helper from the EventFilter
publicly usable by providing a helper with a stream operator.
Change-Id: Ifab83e23cc792a5efe231fd9ae84e0439ab0d609
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'tests/manual/diaglib/eventfilter.h')
-rw-r--r-- | tests/manual/diaglib/eventfilter.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/manual/diaglib/eventfilter.h b/tests/manual/diaglib/eventfilter.h index a65cd9f17d..1f57fbeb8b 100644 --- a/tests/manual/diaglib/eventfilter.h +++ b/tests/manual/diaglib/eventfilter.h @@ -33,6 +33,8 @@ #include <QtCore/QEvent> #include <QtCore/QList> +QT_FORWARD_DECLARE_CLASS(QDebug) + namespace QtDiag { // Event filter that can for example be installed on QApplication @@ -74,6 +76,8 @@ public: ObjectTypes objectTypes() const { return m_objectTypes; } void setObjectTypes(ObjectTypes objectTypes) { m_objectTypes = objectTypes; } + static void formatObject(const QObject *o, QDebug debug); + private: void init(EventCategories eventCategories); @@ -84,6 +88,15 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(EventFilter::EventCategories) Q_DECLARE_OPERATORS_FOR_FLAGS(EventFilter::ObjectTypes) +struct formatQObject +{ + explicit formatQObject(const QObject *o) : m_object(o) {} + + const QObject *m_object; +}; + +QDebug operator<<(QDebug d, const formatQObject &fo); + } // namespace QtDiag #endif |