qtdiag: Add information on touch devices.
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Thu, 26 Mar 2015 11:11:44 +0000 (12:11 +0100)
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Thu, 26 Mar 2015 12:10:18 +0000 (12:10 +0000)
Change-Id: Ibe28292df577bf12311b91952df9034b9636589a
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
src/qtdiag/qtdiag.cpp

index d5869c0..b710be8 100644 (file)
@@ -43,6 +43,7 @@
 #  include <QtGui/QOpenGLFunctions>
 #endif // QT_NO_OPENGL
 #include <QtGui/QWindow>
+#include <QtGui/QTouchDevice>
 
 #ifdef NETWORK_DIAG
 #  include <QSslSocket>
@@ -385,6 +386,33 @@ QString qtDiag(unsigned flags)
             << "\n\n";
     }
 
+    const QList<const QTouchDevice *> touchDevices = QTouchDevice::devices();
+    if (!touchDevices.isEmpty()) {
+        str << "Touch devices: " << touchDevices.size() << '\n';
+        foreach (const QTouchDevice *device, touchDevices) {
+            str << "  " << (device->type() == QTouchDevice::TouchScreen ? "TouchScreen" : "TouchPad")
+                << " \"" << device->name() << "\", max " << device->maximumTouchPoints()
+                << " touch points, capabilities:";
+            const QTouchDevice::Capabilities capabilities = device->capabilities();
+            if (capabilities & QTouchDevice::Position)
+                str << " Position";
+            if (capabilities & QTouchDevice::Area)
+                str << " Area";
+            if (capabilities & QTouchDevice::Pressure)
+                str << " Pressure";
+            if (capabilities & QTouchDevice::Velocity)
+                str << " Velocity";
+            if (capabilities & QTouchDevice::RawPositions)
+                str << " RawPositions";
+            if (capabilities & QTouchDevice::NormalizedPosition)
+                str << " NormalizedPosition";
+            if (capabilities & QTouchDevice::MouseEmulation)
+                str << " MouseEmulation";
+            str << '\n';
+        }
+        str << "\n\n";
+    }
+
 #ifndef QT_NO_OPENGL
     dumpGlInfo(str, flags & QtDiagGlExtensions);
     str << "\n\n";