summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qtouchdevice.cpp23
-rw-r--r--src/gui/kernel/qtouchdevice.h6
-rw-r--r--tests/manual/touch/main.cpp18
3 files changed, 28 insertions, 19 deletions
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index 8737825de0..1a6e9deba8 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -37,6 +37,8 @@
#include <QMutex>
#include <QCoreApplication>
+#include <private/qdebug_p.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -239,4 +241,25 @@ void QTouchDevicePrivate::registerDevice(QTouchDevice *dev)
deviceList()->append(dev);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QTouchDevice *device)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug.noquote();
+ debug << "QTouchDevice(";
+ if (device) {
+ debug << '"' << device->name() << "\", type=";
+ QtDebugUtils::formatQEnum(debug, device->type());
+ debug << ", capabilities=";
+ QtDebugUtils::formatQFlags(debug, device->capabilities());
+ debug << ", maximumTouchPoints=" << device->maximumTouchPoints();
+ } else {
+ debug << '0';
+ }
+ debug << ')';
+ return debug;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 90f0f25d2f..1c1fcc63aa 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -38,7 +38,7 @@
QT_BEGIN_NAMESPACE
-
+class QDebug;
class QTouchDevicePrivate;
class Q_GUI_EXPORT QTouchDevice
@@ -84,6 +84,10 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchDevice::Capabilities)
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QTouchDevice *);
+#endif
+
QT_END_NAMESPACE
#endif // QTOUCHDEVICE_H
diff --git a/tests/manual/touch/main.cpp b/tests/manual/touch/main.cpp
index f4c9f6bf8b..e1114d7f57 100644
--- a/tests/manual/touch/main.cpp
+++ b/tests/manual/touch/main.cpp
@@ -47,24 +47,6 @@
#include <QDebug>
#include <QTextStream>
-QDebug operator<<(QDebug debug, const QTouchDevice *d)
-{
- QDebugStateSaver saver(debug);
- debug.nospace();
- debug << "QTouchDevice(" << d->name() << ',';
- switch (d->type()) {
- case QTouchDevice::TouchScreen:
- debug << "TouchScreen";
- break;
- case QTouchDevice::TouchPad:
- debug << "TouchPad";
- break;
- }
- debug << ", capabilities=" << d->capabilities()
- << ", maximumTouchPoints=" << d->maximumTouchPoints() << ')';
- return debug;
-}
-
typedef QVector<QEvent::Type> EventTypeVector;
class EventFilter : public QObject {