diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-08-04 12:57:55 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-08-05 17:00:45 +0200 |
commit | d7fea8e5d2146af4df40b136c8265287f3a8a8c5 (patch) | |
tree | 39b58f91e8020e2ed538edb35bab04d8a7b6459a | |
parent | 27b67c5399bc068b4bff34dc53b07b0f6b277617 (diff) |
Improve qDebug output for QTabletEvent
Change-Id: Ic2819eaa5ed0e3666062f00994b72dee0b2cba66
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r-- | src/gui/kernel/qevent.cpp | 23 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 7 |
2 files changed, 27 insertions, 3 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 5f009e75fa..457428f569 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3622,10 +3622,27 @@ static void formatDropEvent(QDebug d, const QDropEvent *e) static void formatTabletEvent(QDebug d, const QTabletEvent *e) { const QEvent::Type type = e->type(); - d << eventClassName(type) << '(' << eventTypeName(type) << ", pos=" << e->posF() - << ", pointerType=" << e->pointerType() - << ", pressure=" << e->pressure() << ", rotation=" << e->rotation() + + static const int deviceEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("TabletDevice"); + static const int pointerTypeEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("PointerType"); + const char* device = QTabletEvent::staticMetaObject.enumerator(deviceEnumIdx).valueToKey(e->device()); + const char* pointerType = QTabletEvent::staticMetaObject.enumerator(pointerTypeEnumIdx).valueToKey(e->pointerType()); + + d << eventClassName(type) << '(' << eventTypeName(type) + << ", device=" << device + << ", pointerType=" << pointerType + << ", uniqueId=" << e->uniqueId() + << ", pos=" << e->posF() + << ", z=" << e->z() + << ", xTilt=" << e->xTilt() + << ", yTilt=" << e->yTilt() << ", " << DebugHelper::mouseButtonsToString(e->buttons()).constData(); + if (type == QEvent::TabletPress || type == QEvent::TabletMove) + d << ", pressure=" << e->pressure(); + if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse) + d << ", rotation=" << e->rotation(); + if (e->device() == QTabletEvent::Airbrush) + d << ", tangentialPressure=" << e->tangentialPressure(); } # endif // !QT_NO_TABLETEVENT diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 346c0a4ba0..e123845f66 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -223,6 +223,9 @@ protected: #ifndef QT_NO_TABLETEVENT class Q_GUI_EXPORT QTabletEvent : public QInputEvent { + Q_GADGET + Q_ENUMS(TabletDevice) + Q_ENUMS(PointerType) public: enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, XFreeEraser /*internal*/, RotationStylus }; @@ -761,7 +764,11 @@ public: enum InfoFlag { Pen = 0x0001 }; +#ifndef Q_MOC_RUN + // otherwise moc gives + // Error: Meta object features not supported for nested classes Q_DECLARE_FLAGS(InfoFlags, InfoFlag) +#endif explicit TouchPoint(int id = -1); TouchPoint(const TouchPoint &other); |