Add qDebug() output for QTouchEvent.
Task-number: QTBUG-29946 Task-number: QTBUG-29254 Change-Id: I9371954caf4166041239684e90c09b12038065d3 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
a3f74835f8
commit
28881a91f0
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user