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
qquickpathview_p_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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKPATHVIEW_P_P_H
6#define QQUICKPATHVIEW_P_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 <private/qtquickglobal_p.h>
20
22
24#include "qquickitem_p.h"
25
26#include <QtQml/qqml.h>
27#include <QtCore/qdatetime.h>
28#include <QtCore/qcoreapplication.h>
29
30#include <private/qquickanimation_p_p.h>
31#include <private/qqmldelegatemodel_p.h>
32#include <private/qquicktimeline_p_p.h>
33#include <private/qpodvector_p.h>
34
35#include <QtCore/qpointer.h>
36
38
39class QQmlOpenMetaObjectType;
43{
44 Q_DECLARE_PUBLIC(QQuickPathView)
45
46public:
48
49 void init();
50
51 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override {
52 if (change.sizeChange() && (!highlightItem || item != highlightItem)) {
54 att->m_percent = -1;
56 }
57 }
58
59 void itemDestroyed(QQuickItem *item) override
60 {
61 if (!items.removeOne(item))
62 itemCache.removeOne(item);
63 }
64
66 Q_Q(QQuickPathView);
67 if (!layoutScheduled) {
68 layoutScheduled = true;
69 q->polish();
70 }
71 }
72
73 QQuickItem *getItem(int modelIndex, qreal z = 0, bool async=false);
75 {
76 auto oldCurrentItem = std::exchange(currentItem, nullptr);
77 releaseItem(oldCurrentItem);
78 }
79 void releaseItem(QQuickItem *item);
80 QQuickPathViewAttached *attached(QQuickItem *item);
81 QQmlOpenMetaObjectType *attachedType();
82 void clear();
83 void updateMappedRange();
84 qreal positionOfIndex(qreal index) const;
85 bool isInBound(qreal position, qreal lower, qreal upper, bool emptyRangeCheck = true) const;
86 void createHighlight();
87 void updateHighlight();
88 void setHighlightPosition(qreal pos);
89 bool isValid() const {
90 return model && model->count() > 0 && model->isValid() && path;
91 }
92
93 void handleMousePressEvent(QMouseEvent *event);
94 void handleMouseMoveEvent(QMouseEvent *event);
95 void handleMouseReleaseEvent(QMouseEvent *);
96
97 int calcCurrentIndex();
98 void createCurrentItem();
99 void updateCurrent();
100 static void fixOffsetCallback(void*);
101 void fixOffset();
102 void setOffset(qreal offset);
103 void setAdjustedOffset(qreal offset);
104 void regenerate();
105 void updateItem(QQuickItem *, qreal);
107 void snapToIndex(int index, MovementReason reason);
108 QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const;
109 void addVelocitySample(qreal v);
110 qreal calcVelocity() const;
111 qint64 computeCurrentTime(QInputEvent *event) const;
112 void setDragging(bool d);
113
125 bool stealMouse : 1;
126 bool ownModel : 1;
127 bool interactive : 1;
130 bool highlightUp : 1;
132 bool moving : 1;
133 bool flicking : 1;
134 bool dragging : 1;
135 bool inRequest : 1;
137 bool inRefill : 1;
159 QQmlOpenMetaObjectType *attType;
160 QQmlComponent *highlightComponent;
161 QQuickItem *highlightItem;
171};
172
173QT_END_NAMESPACE
174
175#endif
void setValue(const QByteArray &name, const QVariant &val)
QQuickPathView * view() const
QVariant value(const QByteArray &name) const
QPointer< QQmlInstanceModel > model
void releaseItem(QQuickItem *item)
qint64 computeCurrentTime(QInputEvent *event) const
void updateItem(QQuickItem *, qreal)
void snapToIndex(int index, MovementReason reason)
QPODVector< qreal, 10 > velocityBuffer
void handleMousePressEvent(QMouseEvent *event)
QQmlOpenMetaObjectType * attType
void handleMouseReleaseEvent(QMouseEvent *)
QPointer< QQuickItem > currentItem
QQmlComponent * highlightComponent
void setAdjustedOffset(qreal offset)
QQuickTimeLineValueProxy< QQuickPathViewPrivate > moveHighlight
void setHighlightPosition(qreal pos)
QQuickTimeLineValueProxy< QQuickPathViewPrivate > moveOffset
void handleMouseMoveEvent(QMouseEvent *event)
QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const
void setOffset(qreal offset)
QQmlOpenMetaObjectType * attachedType()
void itemDestroyed(QQuickItem *item) override
qreal positionOfIndex(qreal index) const
QQuickItem * getItem(int modelIndex, qreal z=0, bool async=false)
QList< QQuickItem * > itemCache
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override
void addVelocitySample(qreal v)
QQuickPathViewAttached * attached(QQuickItem *item)
QList< QQuickItem * > items
bool isInBound(qreal position, qreal lower, qreal upper, bool emptyRangeCheck=true) const
static void fixOffsetCallback(void *)
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
QT_REQUIRE_CONFIG(animation)
#define QML_FLICK_SAMPLEBUFFER
#define QML_FLICK_DISCARDSAMPLES
#define QML_FLICK_VELOCITY_DECAY_TIME
static QT_BEGIN_NAMESPACE QQmlOpenMetaObjectType * qPathViewAttachedType
static int currentIndexRemainder(int currentIndex, int modelCount) noexcept
QT_REQUIRE_CONFIG(quick_pathview)