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#include "qquickflickablebehavior_p.h" //Contains flicking behavior defines
26
27#include <QtQml/qqml.h>
28#include <QtCore/qdatetime.h>
29#include <QtCore/qcoreapplication.h>
30
31#include <private/qquickanimation_p_p.h>
32#include <private/qqmldelegatemodel_p.h>
33#include <private/qquicktimeline_p_p.h>
34
35#include <QtCore/qpointer.h>
36
37#include <array>
38
39QT_BEGIN_NAMESPACE
40
41class QQmlOpenMetaObjectType;
45{
46 Q_DECLARE_PUBLIC(QQuickPathView)
47
48public:
50
51 void init();
52
53 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override {
54 if (change.sizeChange() && (!highlightItem || item != highlightItem)) {
56 att->m_percent = -1;
58 }
59 }
60
61 void itemDestroyed(QQuickItem *item) override
62 {
63 if (!items.removeOne(item))
64 itemCache.removeOne(item);
65 }
66
68 Q_Q(QQuickPathView);
69 if (!layoutScheduled) {
70 layoutScheduled = true;
71 q->polish();
72 }
73 }
74
75 QQuickItem *getItem(int modelIndex, qreal z = 0, bool async=false);
77 {
78 auto oldCurrentItem = std::exchange(currentItem, nullptr);
79 releaseItem(oldCurrentItem);
80 }
81 void releaseItem(QQuickItem *item);
82 QQuickPathViewAttached *attached(QQuickItem *item);
83 QQmlOpenMetaObjectType *attachedType();
84 void clear();
85 void updateMappedRange();
86 qreal positionOfIndex(qreal index) const;
87 bool isInBound(qreal position, qreal lower, qreal upper, bool emptyRangeCheck = true) const;
88 void createHighlight();
89 void updateHighlight();
90 void setHighlightPosition(qreal pos);
91 bool isValid() const {
92 return model && model->count() > 0 && model->isValid() && path;
93 }
94
95 void handleMousePressEvent(QMouseEvent *event);
96 void handleMouseMoveEvent(QMouseEvent *event);
97 void handleMouseReleaseEvent(QMouseEvent *);
98
99 int calcCurrentIndex();
100 void createCurrentItem();
101 void updateCurrent();
102 static void fixOffsetCallback(void*);
103 void fixOffset();
104 void setOffset(qreal offset);
105 void setAdjustedOffset(qreal offset);
106 void regenerate();
107 void updateItem(QQuickItem *, qreal);
109 void snapToIndex(int index, MovementReason reason);
110 QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const;
111 void addVelocitySample(qreal v);
112 qreal calcVelocity() const;
113 qint64 computeCurrentTime(QInputEvent *event) const;
114 void setDragging(bool d);
115
127 bool stealMouse : 1;
128 bool ownModel : 1;
129 bool interactive : 1;
132 bool highlightUp : 1;
134 bool moving : 1;
135 bool flicking : 1;
136 bool dragging : 1;
137 bool inRequest : 1;
139 bool inRefill : 1;
161 QQmlOpenMetaObjectType *attType;
162 QQmlComponent *highlightComponent;
163 QQuickItem *highlightItem;
175};
176
177QT_END_NAMESPACE
178
179#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)
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
std::array< qreal, QML_FLICK_SAMPLEBUFFER > velocityBuffer
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 *)
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(animation)
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
#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)