diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-03-25 14:56:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-27 13:19:59 +0100 |
commit | 28881a91f05d9c07f39acf88a992addfc7fa2a58 (patch) | |
tree | 88b3608f385c5e7c77ae331bd1e2e0facdc9d256 | |
parent | a3f74835f85c6524c648851454e961bd9cfb9d3f (diff) |
Add qDebug() output for QTouchEvent.
Task-number: QTBUG-29946
Task-number: QTBUG-29254
Change-Id: I9371954caf4166041239684e90c09b12038065d3
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
-rw-r--r-- | src/gui/kernel/qevent.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index e9527bdc48..f7b7410278 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3071,6 +3071,35 @@ QShortcutEvent::~QShortcutEvent() #endif // QT_NO_SHORTCUT #ifndef QT_NO_DEBUG_STREAM + +static inline void formatTouchEvent(QDebug d, const char *name, const QTouchEvent &t) +{ + d << "QTouchEvent(" << name << " states: " << t.touchPointStates(); + const QList<QTouchEvent::TouchPoint> points = t.touchPoints(); + const int size = points.size(); + d << ", " << size << " points: "; + for (int i = 0; i < size; ++i) { + if (i) + d << ", "; + d << points.at(i).pos() << ' ' << points.at(i).rect(); + switch (points.at(i).state()) { + case Qt::TouchPointPressed: + d << " pressed"; + break; + case Qt::TouchPointReleased: + d << " released"; + break; + case Qt::TouchPointMoved: + d << " moved"; + break; + case Qt::TouchPointStationary: + d << " stationary"; + break; + } + } + d << ')'; +} + QDebug operator<<(QDebug dbg, const QEvent *e) { // More useful event output could be added here if (!e) @@ -3337,6 +3366,14 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::UngrabKeyboard: n = "UngrabKeyboard"; break; + case QEvent::TouchBegin: + n = "TouchBegin"; + case QEvent::TouchUpdate: + n = n ? n : "TouchUpdate"; + case QEvent::TouchEnd: + n = n ? n : "TouchEnd"; + formatTouchEvent(dbg.nospace(), n, *static_cast<const QTouchEvent*>(e)); + return dbg.nospace(); case QEvent::ChildAdded: n = n ? n : "ChildAdded"; case QEvent::ChildPolished: n = n ? n : "ChildPolished"; case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; |