Improve qDebug output for QTabletEvent

Change-Id: Ic2819eaa5ed0e3666062f00994b72dee0b2cba66
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Shawn Rutledge 2014-08-04 12:57:55 +02:00
parent 27b67c5399
commit d7fea8e5d2
2 changed files with 27 additions and 3 deletions

View File

@ -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

View File

@ -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);