Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qscroller.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSCROLLER_H
5#define QSCROLLER_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/QObject>
9#include <QtCore/QPointF>
10#include <QtWidgets/QScrollerProperties>
11
13
15
16
17class QWidget;
20#ifndef QT_NO_GESTURES
22class QMouseFlickGestureRecognizer;
23#endif
24
25class Q_WIDGETS_EXPORT QScroller : public QObject
26{
28 Q_PROPERTY(State state READ state NOTIFY stateChanged)
29 Q_PROPERTY(QScrollerProperties scrollerProperties READ scrollerProperties
30 WRITE setScrollerProperties NOTIFY scrollerPropertiesChanged)
31
32public:
33 enum State
34 {
38 Scrolling
39 };
41
49
50 enum Input
51 {
52 InputPress = 1,
54 InputRelease
55 };
56
57 static bool hasScroller(QObject *target);
58
60 static const QScroller *scroller(const QObject *target);
61
62#ifndef QT_NO_GESTURES
63 static Qt::GestureType grabGesture(QObject *target, ScrollerGestureType gestureType = TouchGesture);
64 static Qt::GestureType grabbedGesture(QObject *target);
65 static void ungrabGesture(QObject *target);
66#endif
67
68 static QList<QScroller *> activeScrollers();
69
70 QObject *target() const;
71
72 State state() const;
73
74 bool handleInput(Input input, const QPointF &position, qint64 timestamp = 0);
75
76 void stop();
77 QPointF velocity() const;
78 QPointF finalPosition() const;
79 QPointF pixelPerMeter() const;
80
81 QScrollerProperties scrollerProperties() const;
82
83 void setSnapPositionsX( const QList<qreal> &positions );
84 void setSnapPositionsX( qreal first, qreal interval );
85 void setSnapPositionsY( const QList<qreal> &positions );
86 void setSnapPositionsY( qreal first, qreal interval );
87
88public Q_SLOTS:
89 void setScrollerProperties(const QScrollerProperties &prop);
90 void scrollTo(const QPointF &pos);
91 void scrollTo(const QPointF &pos, int scrollTime);
92 void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin);
93 void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin, int scrollTime);
94 void resendPrepareEvent();
95
99
100private:
101 QScrollerPrivate *d_ptr;
102
104 virtual ~QScroller();
105
106 Q_DISABLE_COPY(QScroller)
107 Q_DECLARE_PRIVATE(QScroller)
108
109#ifndef QT_NO_GESTURES
111#endif
112};
113
115
116#endif // QSCROLLER_H
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qrect.h:484
The QScrollerProperties class stores the settings for a QScroller.
The QScroller class enables kinetic scrolling for any scrolling widget or graphics item.
Definition qscroller.h:26
Input
This enum contains an input device agnostic view of input events that are relevant for QScroller.
Definition qscroller.h:51
void scrollerPropertiesChanged(const QScrollerProperties &)
QScroller emits this signal whenever its scroller properties change.
State
This enum contains the different QScroller states.
Definition qscroller.h:34
void stateChanged(QScroller::State newstate)
QScroller emits this signal whenever the state changes.
ScrollerGestureType
This enum contains the different gesture types that are supported by the QScroller gesture recognizer...
Definition qscroller.h:43
@ LeftMouseButtonGesture
Definition qscroller.h:45
@ RightMouseButtonGesture
Definition qscroller.h:46
@ TouchGesture
Definition qscroller.h:44
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
rect
[4]
else opt state
[0]
Combined button and popup list for selecting options.
GestureType
static const QCssKnownValue positions[NumKnownPositionModes - 1]
GLenum target
GLint first
GLenum GLenum GLenum input
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
QScroller * scroller
scroller scrollTo(QPointF(100, 100))