Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qgesture.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QGESTURE_H
0005 #define QGESTURE_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qobject.h>
0009 #include <QtCore/qmap.h>
0010 #include <QtCore/qlist.h>
0011 #include <QtCore/qdatetime.h>
0012 #include <QtCore/qpoint.h>
0013 #include <QtCore/qrect.h>
0014 #include <QtCore/qmetatype.h>
0015 #include <QtGui/qevent.h>
0016 
0017 #ifndef QT_NO_GESTURES
0018 
0019 // ### move to qnamespace.h
0020 QT_DECL_METATYPE_EXTERN_TAGGED(Qt::GestureState, Qt__GestureState, Q_WIDGETS_EXPORT)
0021 // ### move to qnamespace.h
0022 QT_DECL_METATYPE_EXTERN_TAGGED(Qt::GestureType, Qt__GestureType, Q_WIDGETS_EXPORT)
0023 
0024 QT_BEGIN_NAMESPACE
0025 
0026 
0027 class QGesturePrivate;
0028 class Q_WIDGETS_EXPORT QGesture : public QObject
0029 {
0030     Q_OBJECT
0031     Q_DECLARE_PRIVATE(QGesture)
0032 
0033     Q_PROPERTY(Qt::GestureState state READ state)
0034     Q_PROPERTY(Qt::GestureType gestureType READ gestureType)
0035     Q_PROPERTY(QGesture::GestureCancelPolicy gestureCancelPolicy READ gestureCancelPolicy
0036                WRITE setGestureCancelPolicy)
0037     Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot)
0038     Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
0039 
0040 public:
0041     explicit QGesture(QObject *parent = nullptr);
0042     ~QGesture();
0043 
0044     Qt::GestureType gestureType() const;
0045 
0046     Qt::GestureState state() const;
0047 
0048     QPointF hotSpot() const;
0049     void setHotSpot(const QPointF &value);
0050     bool hasHotSpot() const;
0051     void unsetHotSpot();
0052 
0053     enum GestureCancelPolicy {
0054         CancelNone = 0,
0055         CancelAllInContext
0056     };
0057 
0058     void setGestureCancelPolicy(GestureCancelPolicy policy);
0059     GestureCancelPolicy gestureCancelPolicy() const;
0060 
0061 protected:
0062     QGesture(QGesturePrivate &dd, QObject *parent);
0063 
0064 private:
0065     friend class QGestureEvent;
0066     friend class QGestureRecognizer;
0067     friend class QGestureManager;
0068     friend class QGraphicsScenePrivate;
0069 };
0070 
0071 class QPanGesturePrivate;
0072 class Q_WIDGETS_EXPORT QPanGesture : public QGesture
0073 {
0074     Q_OBJECT
0075     Q_DECLARE_PRIVATE(QPanGesture)
0076 
0077     Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset)
0078     Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
0079     Q_PROPERTY(QPointF delta READ delta STORED false)
0080     Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
0081     Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal horizontalVelocity READ horizontalVelocity WRITE setHorizontalVelocity)
0082     Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal verticalVelocity READ verticalVelocity WRITE setVerticalVelocity)
0083 
0084 public:
0085     explicit QPanGesture(QObject *parent = nullptr);
0086     ~QPanGesture();
0087 
0088     QPointF lastOffset() const;
0089     QPointF offset() const;
0090     QPointF delta() const;
0091     qreal acceleration() const;
0092 
0093     void setLastOffset(const QPointF &value);
0094     void setOffset(const QPointF &value);
0095     void setAcceleration(qreal value);
0096 
0097     friend class QPanGestureRecognizer;
0098     friend class QWinNativePanGestureRecognizer;
0099 };
0100 
0101 class QPinchGesturePrivate;
0102 class Q_WIDGETS_EXPORT QPinchGesture : public QGesture
0103 {
0104     Q_OBJECT
0105     Q_DECLARE_PRIVATE(QPinchGesture)
0106 
0107 public:
0108     enum ChangeFlag {
0109         ScaleFactorChanged = 0x1,
0110         RotationAngleChanged = 0x2,
0111         CenterPointChanged = 0x4
0112     };
0113     Q_ENUM(ChangeFlag)
0114     Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
0115     Q_FLAG(ChangeFlags)
0116 
0117     Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags)
0118     Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags)
0119 
0120     Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor)
0121     Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor)
0122     Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor)
0123 
0124     Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle)
0125     Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle)
0126     Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle)
0127 
0128     Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint)
0129     Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint)
0130     Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
0131 
0132 public:
0133     explicit QPinchGesture(QObject *parent = nullptr);
0134     ~QPinchGesture();
0135 
0136     ChangeFlags totalChangeFlags() const;
0137     void setTotalChangeFlags(ChangeFlags value);
0138 
0139     ChangeFlags changeFlags() const;
0140     void setChangeFlags(ChangeFlags value);
0141 
0142     QPointF startCenterPoint() const;
0143     QPointF lastCenterPoint() const;
0144     QPointF centerPoint() const;
0145     void setStartCenterPoint(const QPointF &value);
0146     void setLastCenterPoint(const QPointF &value);
0147     void setCenterPoint(const QPointF &value);
0148 
0149     qreal totalScaleFactor() const;
0150     qreal lastScaleFactor() const;
0151     qreal scaleFactor() const;
0152     void setTotalScaleFactor(qreal value);
0153     void setLastScaleFactor(qreal value);
0154     void setScaleFactor(qreal value);
0155 
0156     qreal totalRotationAngle() const;
0157     qreal lastRotationAngle() const;
0158     qreal rotationAngle() const;
0159     void setTotalRotationAngle(qreal value);
0160     void setLastRotationAngle(qreal value);
0161     void setRotationAngle(qreal value);
0162 
0163     friend class QPinchGestureRecognizer;
0164 };
0165 
0166 Q_DECLARE_OPERATORS_FOR_FLAGS(QPinchGesture::ChangeFlags)
0167 
0168 QT_END_NAMESPACE
0169 
0170 QT_DECL_METATYPE_EXTERN_TAGGED(QPinchGesture::ChangeFlags,
0171                                QPinchGesture__ChangeFlags, Q_WIDGETS_EXPORT)
0172 
0173 QT_BEGIN_NAMESPACE
0174 
0175 class QSwipeGesturePrivate;
0176 class Q_WIDGETS_EXPORT QSwipeGesture : public QGesture
0177 {
0178     Q_OBJECT
0179     Q_DECLARE_PRIVATE(QSwipeGesture)
0180 
0181     Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false)
0182     Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false)
0183     Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle)
0184     Q_PRIVATE_PROPERTY(QSwipeGesture::d_func(), qreal velocity READ velocity WRITE setVelocity)
0185 
0186 public:
0187     enum SwipeDirection { NoDirection, Left, Right, Up, Down };
0188     Q_ENUM(SwipeDirection)
0189 
0190     explicit QSwipeGesture(QObject *parent = nullptr);
0191     ~QSwipeGesture();
0192 
0193     SwipeDirection horizontalDirection() const;
0194     SwipeDirection verticalDirection() const;
0195 
0196     qreal swipeAngle() const;
0197     void setSwipeAngle(qreal value);
0198 
0199     friend class QSwipeGestureRecognizer;
0200 };
0201 
0202 class QTapGesturePrivate;
0203 class Q_WIDGETS_EXPORT QTapGesture : public QGesture
0204 {
0205     Q_OBJECT
0206     Q_DECLARE_PRIVATE(QTapGesture)
0207 
0208     Q_PROPERTY(QPointF position READ position WRITE setPosition)
0209 
0210 public:
0211     explicit QTapGesture(QObject *parent = nullptr);
0212     ~QTapGesture();
0213 
0214     QPointF position() const;
0215     void setPosition(const QPointF &pos);
0216 
0217     friend class QTapGestureRecognizer;
0218 };
0219 
0220 class QTapAndHoldGesturePrivate;
0221 class Q_WIDGETS_EXPORT QTapAndHoldGesture : public QGesture
0222 {
0223     Q_OBJECT
0224     Q_DECLARE_PRIVATE(QTapAndHoldGesture)
0225 
0226     Q_PROPERTY(QPointF position READ position WRITE setPosition)
0227 
0228 public:
0229     explicit QTapAndHoldGesture(QObject *parent = nullptr);
0230     ~QTapAndHoldGesture();
0231 
0232     QPointF position() const;
0233     void setPosition(const QPointF &pos);
0234 
0235     static void setTimeout(int msecs);
0236     static int timeout();
0237 
0238     friend class QTapAndHoldGestureRecognizer;
0239 };
0240 
0241 class QGesture;
0242 class QGestureEventPrivate;
0243 class Q_WIDGETS_EXPORT QGestureEvent : public QEvent
0244 {
0245 public:
0246     explicit QGestureEvent(const QList<QGesture *> &gestures);
0247     ~QGestureEvent();
0248 
0249     QList<QGesture *> gestures() const;
0250     QGesture *gesture(Qt::GestureType type) const;
0251 
0252     QList<QGesture *> activeGestures() const;
0253     QList<QGesture *> canceledGestures() const;
0254 
0255     using QEvent::setAccepted;
0256     using QEvent::isAccepted;
0257     using QEvent::accept;
0258     using QEvent::ignore;
0259 
0260     void setAccepted(QGesture *, bool);
0261     void accept(QGesture *);
0262     void ignore(QGesture *);
0263     bool isAccepted(QGesture *) const;
0264 
0265     void setAccepted(Qt::GestureType, bool);
0266     void accept(Qt::GestureType);
0267     void ignore(Qt::GestureType);
0268     bool isAccepted(Qt::GestureType) const;
0269 
0270     void setWidget(QWidget *widget);
0271     QWidget *widget() const;
0272 
0273 #if QT_CONFIG(graphicsview)
0274     QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
0275 #endif
0276 
0277 private:
0278     QList<QGesture *> m_gestures;
0279     QWidget *m_widget;
0280     QMap<Qt::GestureType, bool> m_accepted;
0281     QMap<Qt::GestureType, QWidget *> m_targetWidgets;
0282 
0283     friend class QApplication;
0284     friend class QGestureManager;
0285 };
0286 
0287 #  ifndef QT_NO_DEBUG_STREAM
0288 Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGesture *);
0289 Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGestureEvent *);
0290 #  endif
0291 
0292 QT_END_NAMESPACE
0293 
0294 QT_DECL_METATYPE_EXTERN_TAGGED(QGesture::GestureCancelPolicy,
0295                                QGesture__GestureCancelPolicy, Q_WIDGETS_EXPORT)
0296 
0297 #endif // QT_NO_GESTURES
0298 
0299 #endif // QGESTURE_H