summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qgesture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qgesture.cpp')
-rw-r--r--src/widgets/kernel/qgesture.cpp120
1 files changed, 77 insertions, 43 deletions
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 2b8f04ccdf..713a019cc3 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,7 @@
#include "private/qstandardgestures_p.h"
#include "qgraphicsview.h"
+#include <QtCore/QDebug>
#ifndef QT_NO_GESTURES
QT_BEGIN_NAMESPACE
@@ -1086,46 +1087,79 @@ QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
}
#endif //QT_NO_GRAPHICSVIEW
-#ifdef Q_NO_USING_KEYWORD
-/*!
- \fn void QGestureEvent::setAccepted(bool accepted)
-
- Sets or clears the event's internal flag that determines whether it should
- be delivered to other objects.
-
- Calling this function with a value of true for \a accepted indicates that the
- caller has accepted the event and that it should not be propagated further.
- Calling this function with a value of false indicates that the caller has
- ignored the event and that it should be delivered to other objects.
-
- For convenience, the accept flag can also be set with accept(), and cleared
- with ignore().
-
- \sa QEvent::accepted
-*/
-/*!
- \fn bool QGestureEvent::isAccepted() const
+#ifndef QT_NO_DEBUG_STREAM
- Returns \c true is the event has been accepted; otherwise returns \c false.
-
- \sa QEvent::accepted
-*/
-/*!
- \fn void QGestureEvent::accept()
-
- Accepts the event, the equivalent of calling setAccepted(true).
-
- \sa QEvent::accept()
-*/
-/*!
- \fn void QGestureEvent::ignore()
+static void formatGestureHeader(QDebug d, const char *className, const QGesture *gesture)
+{
+ d << className << "(state=" << gesture->state();
+ if (gesture->hasHotSpot())
+ d << ",hotSpot=" << gesture->hotSpot();
+}
- Ignores the event, the equivalent of calling setAccepted(false).
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGesture *gesture)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ switch (gesture->gestureType()) {
+ case Qt::TapGesture:
+ formatGestureHeader(d, "QTapGesture", gesture);
+ d << ",position=" << static_cast<const QTapGesture*>(gesture)->position() << ')';
+ break;
+ case Qt::TapAndHoldGesture: {
+ const QTapAndHoldGesture *tap = static_cast<const QTapAndHoldGesture*>(gesture);
+ formatGestureHeader(d, "QTapAndHoldGesture", tap);
+ d << ",position=" << tap->position() << ",timeout=" << tap->timeout() << ')';
+ }
+ break;
+ case Qt::PanGesture: {
+ const QPanGesture *pan = static_cast<const QPanGesture*>(gesture);
+ formatGestureHeader(d, "QPanGesture", pan);
+ d << ",lastOffset=" << pan->lastOffset() << ",offset=" << pan->offset()
+ << ",acceleration=" << pan->acceleration()
+ << ",delta=" << pan->delta() << ')';
+ }
+ break;
+ case Qt::PinchGesture: {
+ const QPinchGesture *pinch = static_cast<const QPinchGesture*>(gesture);
+ formatGestureHeader(d, "QPinchGesture", pinch);
+ d << ",totalChangeFlags=" << pinch->totalChangeFlags()
+ << ",changeFlags=" << pinch->changeFlags()
+ << ",startCenterPoint=" << pinch->startCenterPoint()
+ << ",lastCenterPoint=" << pinch->lastCenterPoint()
+ << ",centerPoint=" << pinch->centerPoint()
+ << ",totalScaleFactor=" << pinch->totalScaleFactor()
+ << ",lastScaleFactor=" << pinch->lastScaleFactor()
+ << ",scaleFactor=" << pinch->scaleFactor()
+ << ",totalRotationAngle=" << pinch->totalRotationAngle()
+ << ",lastRotationAngle=" << pinch->lastRotationAngle()
+ << ",rotationAngle=" << pinch->rotationAngle() << ')';
+ }
+ break;
+ case Qt::SwipeGesture: {
+ const QSwipeGesture *swipe = static_cast<const QSwipeGesture*>(gesture);
+ formatGestureHeader(d, "QSwipeGesture", swipe);
+ d << ",horizontalDirection=" << swipe->horizontalDirection()
+ << ",verticalDirection=" << swipe->verticalDirection()
+ << ",swipeAngle=" << swipe->swipeAngle() << ')';
+ }
+ break;
+ default:
+ formatGestureHeader(d, "Custom gesture", gesture);
+ d << ",type=" << gesture->gestureType() << ')';
+ break;
+ }
+ return d;
+}
- \sa QEvent::ignore()
-*/
-#endif
+Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGestureEvent *gestureEvent)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "QGestureEvent(" << gestureEvent->gestures() << ')';
+ return d;
+}
+#endif // !QT_NO_DEBUG_STREAM
QT_END_NAMESPACE
#include <moc_qgesture.cpp>