Debug logging support for QNativeGestureEvent

The most useful information is what kind of gesture the event
represents, but it was missing until now.

Also added a line of documentation about the NativeGesture event type.

Change-Id: I1ba3c951dcc5751e937d762d9b647ab0bf8d93b8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
bb10
Shawn Rutledge 2014-08-21 15:30:41 +02:00
parent d88de0452a
commit dd6080ceac
3 changed files with 10 additions and 1 deletions

View File

@ -98,6 +98,7 @@ Qt {
#ifndef QT_NO_GESTURES
Q_ENUMS(GestureState)
Q_ENUMS(GestureType)
Q_ENUMS(NativeGestureType)
#endif
Q_ENUMS(CursorMoveStyle)
Q_ENUMS(TimerType)

View File

@ -184,6 +184,7 @@ QT_BEGIN_NAMESPACE
\value MouseMove Mouse move (QMouseEvent).
\value MouseTrackingChange The mouse tracking state has changed.
\value Move Widget's position changed (QMoveEvent).
\value NativeGesture The system has detected a gesture (QNativeGestureEvent).
\value OrientationChange The screens orientation has changes (QScreenOrientationChangeEvent)
\value Paint Screen update necessary (QPaintEvent).
\value PaletteChange Palette of the widget changed.

View File

@ -3595,6 +3595,12 @@ public:
static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("FocusReason");
return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(reason);
}
static const char *nativeGestureTypeToString(Qt::NativeGestureType type)
{
static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("NativeGestureType");
return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(type);
}
};
} // namespace
@ -3775,7 +3781,8 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
# ifndef QT_NO_GESTURES
case QEvent::NativeGesture: {
const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
dbg << "QNativeGestureEvent(localPos=" << ne->localPos() << ", value=" << ne->value() << ')';
dbg << "QNativeGestureEvent(" << DebugHelper::nativeGestureTypeToString(ne->gestureType())
<< "localPos=" << ne->localPos() << ", value=" << ne->value() << ')';
}
break;
# endif // !QT_NO_GESTURES