Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:37

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 QSCROLLER_H
0005 #define QSCROLLER_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/QObject>
0009 #include <QtCore/QPointF>
0010 #include <QtWidgets/QScrollerProperties>
0011 
0012 QT_REQUIRE_CONFIG(scroller);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 
0017 class QWidget;
0018 class QScrollerPrivate;
0019 class QScrollerProperties;
0020 #ifndef QT_NO_GESTURES
0021 class QFlickGestureRecognizer;
0022 class QMouseFlickGestureRecognizer;
0023 #endif
0024 
0025 class Q_WIDGETS_EXPORT QScroller : public QObject
0026 {
0027     Q_OBJECT
0028     Q_PROPERTY(State state READ state NOTIFY stateChanged)
0029     Q_PROPERTY(QScrollerProperties scrollerProperties READ scrollerProperties
0030                WRITE setScrollerProperties NOTIFY scrollerPropertiesChanged)
0031 
0032 public:
0033     enum State
0034     {
0035         Inactive,
0036         Pressed,
0037         Dragging,
0038         Scrolling
0039     };
0040     Q_ENUM(State)
0041 
0042     enum ScrollerGestureType
0043     {
0044         TouchGesture,
0045         LeftMouseButtonGesture,
0046         RightMouseButtonGesture,
0047         MiddleMouseButtonGesture
0048     };
0049 
0050     enum Input
0051     {
0052         InputPress = 1,
0053         InputMove,
0054         InputRelease
0055     };
0056 
0057     static bool hasScroller(QObject *target);
0058 
0059     static QScroller *scroller(QObject *target);
0060     static const QScroller *scroller(const QObject *target);
0061 
0062 #ifndef QT_NO_GESTURES
0063     static Qt::GestureType grabGesture(QObject *target, ScrollerGestureType gestureType = TouchGesture);
0064     static Qt::GestureType grabbedGesture(QObject *target);
0065     static void ungrabGesture(QObject *target);
0066 #endif
0067 
0068     static QList<QScroller *> activeScrollers();
0069 
0070     QObject *target() const;
0071 
0072     State state() const;
0073 
0074     bool handleInput(Input input, const QPointF &position, qint64 timestamp = 0);
0075 
0076     void stop();
0077     QPointF velocity() const;
0078     QPointF finalPosition() const;
0079     QPointF pixelPerMeter() const;
0080 
0081     QScrollerProperties scrollerProperties() const;
0082 
0083     void setSnapPositionsX( const QList<qreal> &positions );
0084     void setSnapPositionsX( qreal first, qreal interval );
0085     void setSnapPositionsY( const QList<qreal> &positions );
0086     void setSnapPositionsY( qreal first, qreal interval );
0087 
0088 public Q_SLOTS:
0089     void setScrollerProperties(const QScrollerProperties &prop);
0090     void scrollTo(const QPointF &pos);
0091     void scrollTo(const QPointF &pos, int scrollTime);
0092     void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin);
0093     void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin, int scrollTime);
0094     void resendPrepareEvent();
0095 
0096 Q_SIGNALS:
0097     void stateChanged(QScroller::State newstate);
0098     void scrollerPropertiesChanged(const QScrollerProperties &);
0099 
0100 private:
0101     QScrollerPrivate *d_ptr;
0102 
0103     QScroller(QObject *target);
0104     virtual ~QScroller();
0105 
0106     Q_DISABLE_COPY(QScroller)
0107     Q_DECLARE_PRIVATE(QScroller)
0108 
0109 #ifndef QT_NO_GESTURES
0110     friend class QFlickGestureRecognizer;
0111 #endif
0112 };
0113 
0114 QT_END_NAMESPACE
0115 
0116 #endif // QSCROLLER_H