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
qquickpathview_p.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 QQUICKPATHVIEW_P_H
5#define QQUICKPATHVIEW_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 <private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_pathview);
21
22#include "qquickitem.h"
23
24#include <private/qtquickglobal_p.h>
25#include <private/qquickpath_p.h>
26
28
29class QQmlChangeSet;
30
33class Q_QUICK_EXPORT QQuickPathView : public QQuickItem
34{
36
37 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
38 Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged)
39 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
40 Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged)
41 Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged)
42
43 Q_PROPERTY(QQmlComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged)
44 Q_PROPERTY(QQuickItem *highlightItem READ highlightItem NOTIFY highlightItemChanged)
45
46 Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged)
47 Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged)
48 Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged)
49 Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged)
50
51 Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged)
52 Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged)
53 Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
54 Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged)
55
56 Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged)
57 Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged)
58 Q_PROPERTY(bool dragging READ isDragging NOTIFY draggingChanged)
59
60 Q_PROPERTY(int count READ count NOTIFY countChanged)
61 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
62 Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount RESET resetPathItemCount NOTIFY pathItemCountChanged)
63 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged)
64 Q_PROPERTY(MovementDirection movementDirection READ movementDirection WRITE setMovementDirection NOTIFY movementDirectionChanged REVISION(2, 7))
65
66 Q_PROPERTY(int cacheItemCount READ cacheItemCount WRITE setCacheItemCount NOTIFY cacheItemCountChanged)
67 QML_NAMED_ELEMENT(PathView)
70
71public:
72 QQuickPathView(QQuickItem *parent = nullptr);
73 virtual ~QQuickPathView();
74
75 QVariant model() const;
76 void setModel(const QVariant &);
77
78 QQuickPath *path() const;
79 void setPath(QQuickPath *);
80
81 int currentIndex() const;
82 void setCurrentIndex(int idx);
83
84 QQuickItem *currentItem() const;
85
86 qreal offset() const;
87 void setOffset(qreal offset);
88
89 QQmlComponent *highlight() const;
90 void setHighlight(QQmlComponent *highlight);
91 QQuickItem *highlightItem() const;
92
93 enum HighlightRangeMode { NoHighlightRange, ApplyRange, StrictlyEnforceRange };
94 Q_ENUM(HighlightRangeMode)
95 HighlightRangeMode highlightRangeMode() const;
96 void setHighlightRangeMode(HighlightRangeMode mode);
97
98 qreal preferredHighlightBegin() const;
99 void setPreferredHighlightBegin(qreal);
100
101 qreal preferredHighlightEnd() const;
102 void setPreferredHighlightEnd(qreal);
103
104 int highlightMoveDuration() const;
105 void setHighlightMoveDuration(int);
106
107 qreal dragMargin() const;
108 void setDragMargin(qreal margin);
109
110 qreal flickDeceleration() const;
111 void setFlickDeceleration(qreal dec);
112
113 qreal maximumFlickVelocity() const;
114 void setMaximumFlickVelocity(qreal);
115
116 bool isInteractive() const;
117 void setInteractive(bool);
118
119 bool isMoving() const;
120 bool isFlicking() const;
121 bool isDragging() const;
122
123 int count() const;
124
125 QQmlComponent *delegate() const;
126 void setDelegate(QQmlComponent *);
127
128 int pathItemCount() const;
129 void setPathItemCount(int);
130 void resetPathItemCount();
131
132 int cacheItemCount() const;
133 void setCacheItemCount(int);
134
135 enum SnapMode { NoSnap, SnapToItem, SnapOneItem };
136 Q_ENUM(SnapMode)
137 SnapMode snapMode() const;
138 void setSnapMode(SnapMode mode);
139
140 enum MovementDirection { Shortest, Negative, Positive };
141 Q_ENUM(MovementDirection)
142 MovementDirection movementDirection() const;
143 void setMovementDirection(MovementDirection dir);
144
145 enum PositionMode { Beginning, Center, End, Contain=4, SnapPosition }; // 3 == Visible in other views
146 Q_ENUM(PositionMode)
147 Q_INVOKABLE void positionViewAtIndex(int index, int mode);
148 Q_INVOKABLE int indexAt(qreal x, qreal y) const;
149 Q_INVOKABLE QQuickItem *itemAt(qreal x, qreal y) const;
150 Q_REVISION(2, 13) Q_INVOKABLE QQuickItem *itemAtIndex(int index) const;
151
152 static QQuickPathViewAttached *qmlAttachedProperties(QObject *);
153
154public Q_SLOTS:
155 void incrementCurrentIndex();
156 void decrementCurrentIndex();
157
159 void currentIndexChanged();
160 void currentItemChanged();
161 void offsetChanged();
162 void modelChanged();
163 void countChanged();
164 void pathChanged();
165 void preferredHighlightBeginChanged();
166 void preferredHighlightEndChanged();
167 void highlightRangeModeChanged();
168 void dragMarginChanged();
169 void snapPositionChanged();
170 void delegateChanged();
171 void pathItemCountChanged();
172 void maximumFlickVelocityChanged();
173 void flickDecelerationChanged();
174 void interactiveChanged();
175 void movingChanged();
176 void flickingChanged();
177 void draggingChanged();
178 void highlightChanged();
179 void highlightItemChanged();
180 void highlightMoveDurationChanged();
181 void movementStarted();
182 void movementEnded();
183 Q_REVISION(2, 7) void movementDirectionChanged();
184 void flickStarted();
185 void flickEnded();
186 void dragStarted();
187 void dragEnded();
188 void snapModeChanged();
189 void cacheItemCountChanged();
190
191protected:
192 void updatePolish() override;
193 void mousePressEvent(QMouseEvent *event) override;
194 void mouseMoveEvent(QMouseEvent *event) override;
195 void mouseReleaseEvent(QMouseEvent *) override;
196 bool childMouseEventFilter(QQuickItem *, QEvent *) override;
197 void mouseUngrabEvent() override;
198 void componentComplete() override;
199
201 void refill();
202 void ticked();
203 void movementEnding();
204 void modelUpdated(const QQmlChangeSet &changeSet, bool reset);
205 void createdItem(int index, QObject *item);
206 void initItem(int index, QObject *item);
207 void destroyingItem(QObject *item);
208 void pathUpdated();
209
210private:
212 Q_DISABLE_COPY(QQuickPathView)
213 Q_DECLARE_PRIVATE(QQuickPathView)
214};
215
218{
220
221 Q_PROPERTY(QQuickPathView *view READ view CONSTANT FINAL)
222 Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged FINAL)
223 Q_PROPERTY(bool onPath READ isOnPath NOTIFY pathChanged FINAL)
224
225public:
228
229 QQuickPathView *view() const { return m_view; }
230
231 bool isCurrentItem() const { return m_isCurrent; }
232 void setIsCurrentItem(bool c) {
233 if (m_isCurrent != c) {
234 m_isCurrent = c;
235 Q_EMIT currentItemChanged();
236 }
237 }
238
239 QVariant value(const QByteArray &name) const;
240 void setValue(const QByteArray &name, const QVariant &val);
241
242 bool isOnPath() const { return m_onPath; }
243 void setOnPath(bool on) {
244 if (on != m_onPath) {
245 m_onPath = on;
246 Q_EMIT pathChanged();
247 }
248 }
250
254
255private:
257 friend class QQuickPathView;
258 QQuickPathView *m_view;
259 QQmlOpenMetaObject *m_metaobject;
260 bool m_onPath : 1;
261 bool m_isCurrent : 1;
262};
263
264
266
267#endif // QQUICKPATHVIEW_P_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set.
The QQmlComponent class encapsulates a QML component definition.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
Q_REVISION(2, 13) Q_INVOKABLE QQuickItem *itemAtIndex(int index) const
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLint GLint GLint GLint GLint x
[0]
GLenum mode
GLuint index
[2]
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
GLuint name
GLint y
struct _cl_event * event
GLboolean reset
const GLubyte * c
GLuint GLfloat * val
GLsizei const GLchar *const * path
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QML_ATTACHED(ATTACHED_TYPE)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_EMIT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
view setModel(model)
[17] //! [18]
QSqlQueryModel * model
[16]
settings setValue("DataPump/bgcolor", color)
QString dir
[11]
QGraphicsItem * item
QQuickView * view
[0]