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
qquicktumbler_p_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 QQUICKTUMBLER_P_P_H
6#define QQUICKTUMBLER_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 <QtQuickTemplates2/private/qquickcontrol_p_p.h>
20#include <QtQuickTemplates2/private/qquicktumbler_p.h>
21
22#include <QtCore/qpointer.h>
23#include <QtQml/private/qqmlpropertyutils_p.h>
24
26
27class Q_QUICKTEMPLATES2_EXPORT QQuickTumblerPrivate : public QQuickControlPrivate
28{
29 Q_DECLARE_PUBLIC(QQuickTumbler)
30
31public:
32 enum ContentItemType {
33 NoContentItem,
34 UnsupportedContentItemType,
35 PathViewContentItem,
36 ListViewContentItem
37 };
38
39 QQuickItem *determineViewType(QQuickItem *contentItem);
40 void resetViewData();
41 QList<QQuickItem *> viewContentItemChildItems() const;
42
43 static QQuickTumblerPrivate *get(QQuickTumbler *tumbler);
44
45 QPalette defaultPalette() const override;
46
47 QVariant model;
48 QQmlComponent *delegate = nullptr;
49 int visibleItemCount = 5;
50 bool wrap = true;
51 bool explicitWrap = false;
52 qreal flickDeceleration = 0.0;
53 bool modelBeingSet = false;
54 bool currentIndexSetDuringModelChange = false;
55 QQuickItem *view = nullptr;
56 QQuickItem *viewContentItem = nullptr;
57 ContentItemType viewContentItemType = UnsupportedContentItemType;
58 union {
59 qreal viewOffset; // PathView
60 qreal viewContentY; // ListView
61 };
62 int currentIndex = -1;
63 int pendingCurrentIndex = -1;
64 bool ignoreCurrentIndexChanges = false;
65 int count = 0;
66 bool ignoreSignals = false;
67
68 void _q_updateItemHeights();
69 void _q_updateItemWidths();
70 void _q_onViewCurrentIndexChanged();
71 void _q_onViewCountChanged();
72 void _q_onViewOffsetChanged();
73 void _q_onViewContentYChanged();
74
75 void calculateDisplacements();
76
77 void disconnectFromView();
78 void setupViewData(QQuickItem *newControlContentItem);
79 void warnAboutIncorrectContentItem();
80 void syncCurrentIndex();
81 void setPendingCurrentIndex(int index);
82
83 enum PropertyChangeReason {
84 UserChange,
85 InternalChange
86 };
87
88 static QString propertyChangeReasonToString(PropertyChangeReason changeReason);
89
90 void setCurrentIndex(int newCurrentIndex, PropertyChangeReason changeReason = InternalChange);
91 void setCount(int newCount);
92 void setWrapBasedOnCount();
93 void setWrap(bool shouldWrap, QQml::PropertyUtils::State propertyState);
94 qreal effectiveFlickDeceleration() const;
95 void beginSetModel();
96 void endSetModel();
97
98 void itemChildAdded(QQuickItem *, QQuickItem *) override;
99 void itemChildRemoved(QQuickItem *, QQuickItem *) override;
100 void itemGeometryChanged(QQuickItem *, QQuickGeometryChange , const QRectF &) override;
101};
102
104{
105 Q_DECLARE_PUBLIC(QQuickTumblerAttached)
106
107public:
112
114
116 void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
117
118 // The Tumbler that contains the delegate. Required to calculated the displacement.
120 // The index of the delegate. Used to calculate the displacement.
121 int index = -1;
122 // The displacement for our delegate.
124};
125
126QT_END_NAMESPACE
127
128#endif // QQUICKTUMBLER_P_P_H
void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement)
QPointer< QQuickTumbler > tumbler