1// Copyright (C) 2017 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 QQUICKSCROLLINDICATOR_P_H
5#define QQUICKSCROLLINDICATOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickcontrol_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QQuickFlickable;
23class QQuickScrollIndicatorAttached;
24class QQuickScrollIndicatorPrivate;
25
26class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicator : public QQuickControl
27{
28 Q_OBJECT
29 Q_PROPERTY(qreal size READ size WRITE setSize NOTIFY sizeChanged FINAL)
30 Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
31 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
32 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
33 // 2.3 (Qt 5.10)
34 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION(2, 3))
35 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION(2, 3))
36 // 2.4 (Qt 5.11)
37 Q_PROPERTY(qreal minimumSize READ minimumSize WRITE setMinimumSize NOTIFY minimumSizeChanged FINAL REVISION(2, 4))
38 Q_PROPERTY(qreal visualSize READ visualSize NOTIFY visualSizeChanged FINAL REVISION(2, 4))
39 Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL REVISION(2, 4))
40 QML_NAMED_ELEMENT(ScrollIndicator)
41 QML_ATTACHED(QQuickScrollIndicatorAttached)
42 QML_ADDED_IN_VERSION(2, 0)
43
44public:
45 explicit QQuickScrollIndicator(QQuickItem *parent = nullptr);
46
47 static QQuickScrollIndicatorAttached *qmlAttachedProperties(QObject *object);
48
49 qreal size() const;
50 qreal position() const;
51
52 bool isActive() const;
53 void setActive(bool active);
54
55 Qt::Orientation orientation() const;
56 void setOrientation(Qt::Orientation orientation);
57
58 // 2.3 (Qt 5.10)
59 bool isHorizontal() const;
60 bool isVertical() const;
61
62 // 2.4 (Qt 5.11)
63 qreal minimumSize() const;
64 void setMinimumSize(qreal minimumSize);
65
66 qreal visualSize() const;
67 qreal visualPosition() const;
68
69public Q_SLOTS:
70 void setSize(qreal size);
71 void setPosition(qreal position);
72
73Q_SIGNALS:
74 void sizeChanged();
75 void positionChanged();
76 void activeChanged();
77 void orientationChanged();
78 // 2.4 (Qt 5.11)
79 Q_REVISION(2, 4) void minimumSizeChanged();
80 Q_REVISION(2, 4) void visualSizeChanged();
81 Q_REVISION(2, 4) void visualPositionChanged();
82
83protected:
84#if QT_CONFIG(quicktemplates2_multitouch)
85 void touchEvent(QTouchEvent *event) override;
86#endif
87
88#if QT_CONFIG(accessibility)
89 QAccessible::Role accessibleRole() const override;
90#endif
91
92private:
93 Q_DISABLE_COPY(QQuickScrollIndicator)
94 Q_DECLARE_PRIVATE(QQuickScrollIndicator)
95};
96
97class QQuickScrollIndicatorAttachedPrivate;
98
99class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicatorAttached : public QObject
100{
101 Q_OBJECT
102 Q_PROPERTY(QQuickScrollIndicator *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
103 Q_PROPERTY(QQuickScrollIndicator *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
104
105public:
106 explicit QQuickScrollIndicatorAttached(QObject *parent = nullptr);
107 ~QQuickScrollIndicatorAttached();
108
109 QQuickScrollIndicator *horizontal() const;
110 void setHorizontal(QQuickScrollIndicator *horizontal);
111
112 QQuickScrollIndicator *vertical() const;
113 void setVertical(QQuickScrollIndicator *vertical);
114
115Q_SIGNALS:
116 void horizontalChanged();
117 void verticalChanged();
118
119private:
120 Q_DISABLE_COPY(QQuickScrollIndicatorAttached)
121 Q_DECLARE_PRIVATE(QQuickScrollIndicatorAttached)
122};
123
124QT_END_NAMESPACE
125
126QML_DECLARE_TYPE(QQuickScrollIndicator)
127
128#endif // QQUICKSCROLLINDICATOR_P_H
129

source code of qtdeclarative/src/quicktemplates/qquickscrollindicator_p.h