Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickscrollbar_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKSCROLLBAR_P_H
6#define QQUICKSCROLLBAR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickcontrol_p.h>
20#include <QtQuickTemplates2/private/qquickindicatorbutton_p.h>
21QT_BEGIN_NAMESPACE
22
23class QQuickScrollBarAttached;
25
26class Q_QUICKTEMPLATES2_EXPORT QQuickScrollBar : 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(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
32 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
33 Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
34 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
35 // 2.2 (Qt 5.9)
36 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL REVISION(2, 2))
37 Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive RESET resetInteractive NOTIFY interactiveChanged FINAL REVISION(2, 2))
38 Q_PROPERTY(Policy policy READ policy WRITE setPolicy NOTIFY policyChanged FINAL REVISION(2, 2))
39 // 2.3 (Qt 5.10)
40 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION(2, 3))
41 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION(2, 3))
42 // 2.4 (Qt 5.11)
43 Q_PROPERTY(qreal minimumSize READ minimumSize WRITE setMinimumSize NOTIFY minimumSizeChanged FINAL REVISION(2, 4))
44 Q_PROPERTY(qreal visualSize READ visualSize NOTIFY visualSizeChanged FINAL REVISION(2, 4))
45 Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL REVISION(2, 4))
46
47 Q_PROPERTY(QQuickIndicatorButton *__decreaseVisual READ decreaseVisual CONSTANT FINAL)
48 Q_PROPERTY(QQuickIndicatorButton *__increaseVisual READ increaseVisual CONSTANT FINAL)
49
50 QML_NAMED_ELEMENT(ScrollBar)
51 QML_ATTACHED(QQuickScrollBarAttached)
52 QML_ADDED_IN_VERSION(2, 0)
53
54public:
55 explicit QQuickScrollBar(QQuickItem *parent = nullptr);
56
57 static QQuickScrollBarAttached *qmlAttachedProperties(QObject *object);
58
59 qreal size() const;
60 qreal position() const;
61
62 qreal stepSize() const;
63 void setStepSize(qreal step);
64
65 bool isActive() const;
66 void setActive(bool active);
67
68 bool isPressed() const;
69 void setPressed(bool pressed);
70
71 Qt::Orientation orientation() const;
72 void setOrientation(Qt::Orientation orientation);
73
74 // 2.2 (Qt 5.9)
75 enum SnapMode {
76 NoSnap,
77 SnapAlways,
78 SnapOnRelease
79 };
80 Q_ENUM(SnapMode)
81
82 SnapMode snapMode() const;
83 void setSnapMode(SnapMode mode);
84
85 bool isInteractive() const;
86 void setInteractive(bool interactive);
87 void resetInteractive();
88
89 enum Policy {
90 AsNeeded = Qt::ScrollBarAsNeeded,
91 AlwaysOff = Qt::ScrollBarAlwaysOff,
92 AlwaysOn = Qt::ScrollBarAlwaysOn
93 };
94 Q_ENUM(Policy)
95
96 Policy policy() const;
97 void setPolicy(Policy policy);
98
99 // 2.3 (Qt 5.10)
100 bool isHorizontal() const;
101 bool isVertical() const;
102
103 // 2.4 (Qt 5.11)
104 qreal minimumSize() const;
105 void setMinimumSize(qreal minimumSize);
106
107 qreal visualSize() const;
108 qreal visualPosition() const;
109
110 QQuickIndicatorButton *decreaseVisual();
111 QQuickIndicatorButton *increaseVisual();
112
113public Q_SLOTS:
114 void increase();
115 void decrease();
116 void setSize(qreal size);
117 void setPosition(qreal position);
118
119Q_SIGNALS:
120 void sizeChanged();
121 void positionChanged();
122 void stepSizeChanged();
123 void activeChanged();
124 void pressedChanged();
125 void orientationChanged();
126 // 2.2 (Qt 5.9)
127 Q_REVISION(2, 2) void snapModeChanged();
128 Q_REVISION(2, 2) void interactiveChanged();
129 Q_REVISION(2, 2) void policyChanged();
130 // 2.4 (Qt 5.11)
131 Q_REVISION(2, 4) void minimumSizeChanged();
132 Q_REVISION(2, 4) void visualSizeChanged();
133 Q_REVISION(2, 4) void visualPositionChanged();
134
135protected:
136 void mousePressEvent(QMouseEvent *event) override;
137
138#if QT_CONFIG(quicktemplates2_hover)
139 void hoverChange() override;
140 void hoverEnterEvent(QHoverEvent *event) override;
141 void hoverMoveEvent(QHoverEvent *event) override;
142 void hoverLeaveEvent(QHoverEvent *event) override;
143#endif
144
145 void classBegin() override;
146 void componentComplete() override;
147
148#if QT_CONFIG(accessibility)
149 void accessibilityActiveChanged(bool active) override;
150 QAccessible::Role accessibleRole() const override;
151#endif
152
153private:
154 Q_DISABLE_COPY(QQuickScrollBar)
155 Q_DECLARE_PRIVATE(QQuickScrollBar)
156};
157
159
160class Q_QUICKTEMPLATES2_EXPORT QQuickScrollBarAttached : public QObject
161{
162 Q_OBJECT
163 Q_PROPERTY(QQuickScrollBar *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
164 Q_PROPERTY(QQuickScrollBar *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
165
166public:
167 explicit QQuickScrollBarAttached(QObject *parent = nullptr);
168 ~QQuickScrollBarAttached();
169
170 QQuickScrollBar *horizontal() const;
171 void setHorizontal(QQuickScrollBar *horizontal);
172
173 QQuickScrollBar *vertical() const;
174 void setVertical(QQuickScrollBar *vertical);
175
176Q_SIGNALS:
177 void horizontalChanged();
178 void verticalChanged();
179
180private:
181 Q_DISABLE_COPY(QQuickScrollBarAttached)
182 Q_DECLARE_PRIVATE(QQuickScrollBarAttached)
183};
184
185QT_END_NAMESPACE
186
187#endif // QQUICKSCROLLBAR_P_H
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
void setFlickable(QQuickFlickable *flickable)
void layoutHorizontal(bool move=true)
void itemImplicitHeightChanged(QQuickItem *item) override
void itemDestroyed(QQuickItem *item) override
void itemImplicitWidthChanged(QQuickItem *item) override
void itemImplicitHeightChanged(QQuickItem *item) override
bool handlePress(const QPointF &point, ulong timestamp) override
qreal snapPosition(qreal position) const
void itemImplicitWidthChanged(QQuickItem *item) override
void updateHover(const QPointF &pos, std::optional< bool > newHoverState={})
bool handleRelease(const QPointF &point, ulong timestamp) override
bool handleMove(const QPointF &point, ulong timestamp) override
void visualAreaChange(const VisualArea &newVisualArea, const VisualArea &oldVisualArea)
qreal positionAt(const QPointF &point) const
void setPosition(qreal position, bool notifyVisualChange=true)
void setInteractive(bool interactive)
void resizeContent() override
qreal logicalPosition(qreal position) const
VisualArea visualArea() const
static QT_BEGIN_NAMESPACE const QQuickItemPrivate::ChangeTypes QsbChangeTypes
Vertical or horizontal interactive scroll bar.
static const QQuickItemPrivate::ChangeTypes QsbVerticalChangeTypes
static const QQuickItemPrivate::ChangeTypes QsbHorizontalChangeTypes