5#ifndef QQUICKLISTVIEW_P_H
6#define QQUICKLISTVIEW_P_H
19#include <private/qtquickglobal_p.h>
25#include <private/qtquickglobal_p.h>
27#include <QtCore/qpointer.h>
36 Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
37 Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY criteriaChanged)
38 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
39 Q_PROPERTY(
int labelPositioning READ labelPositioning WRITE setLabelPositioning NOTIFY labelPositioningChanged)
40 QML_NAMED_ELEMENT(ViewSection)
41 QML_ADDED_IN_VERSION(2, 0)
43 QQuickViewSection(QQuickListView *parent=
nullptr);
45 QString property()
const {
return m_property; }
46 void setProperty(
const QString &);
48 enum SectionCriteria { FullString, FirstCharacter };
49 Q_ENUM(SectionCriteria)
50 SectionCriteria criteria()
const {
return m_criteria; }
51 void setCriteria(SectionCriteria);
53 QQmlComponent *delegate()
const {
return m_delegate; }
54 void setDelegate(QQmlComponent *delegate);
56 QString sectionString(
const QString &value);
58 enum LabelPositioning { InlineLabels = 0x01, CurrentLabelAtStart = 0x02, NextLabelAtEnd = 0x04 };
59 Q_ENUM(LabelPositioning)
60 int labelPositioning()
const {
return m_labelPositioning; }
61 void setLabelPositioning(
int pos);
64 void sectionsChanged();
65 void propertyChanged();
66 void criteriaChanged();
67 void delegateChanged();
68 void labelPositioningChanged();
72 SectionCriteria m_criteria;
73 QQmlComponent *m_delegate;
74 int m_labelPositioning;
75 QQuickListViewPrivate *m_view;
79class QQmlInstanceModel;
80class QQuickListViewAttached;
84 Q_DECLARE_PRIVATE(QQuickListView)
86 Q_PROPERTY(qreal highlightMoveVelocity READ highlightMoveVelocity WRITE setHighlightMoveVelocity NOTIFY highlightMoveVelocityChanged)
87 Q_PROPERTY(qreal highlightResizeVelocity READ highlightResizeVelocity WRITE setHighlightResizeVelocity NOTIFY highlightResizeVelocityChanged)
88 Q_PROPERTY(
int highlightResizeDuration READ highlightResizeDuration WRITE setHighlightResizeDuration NOTIFY highlightResizeDurationChanged)
90 Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
91 Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
93 Q_PROPERTY(QQuickViewSection *section READ sectionCriteria CONSTANT)
94 Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged)
96 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged)
98 Q_PROPERTY(HeaderPositioning headerPositioning READ headerPositioning WRITE setHeaderPositioning NOTIFY headerPositioningChanged REVISION(2, 4))
99 Q_PROPERTY(FooterPositioning footerPositioning READ footerPositioning WRITE setFooterPositioning NOTIFY footerPositioningChanged REVISION(2, 4))
101 Q_CLASSINFO(
"DefaultProperty",
"data")
102 QML_NAMED_ELEMENT(ListView)
103 QML_ADDED_IN_VERSION(2, 0)
104 QML_ATTACHED(QQuickListViewAttached)
107 QQuickListView(QQuickItem *parent=
nullptr);
110 qreal spacing()
const;
111 void setSpacing(qreal spacing);
113 enum Orientation { Horizontal = Qt::Horizontal, Vertical = Qt::Vertical };
115 Orientation orientation()
const;
116 void setOrientation(Orientation);
118 QQuickViewSection *sectionCriteria();
119 QString currentSection()
const;
121 void setHighlightFollowsCurrentItem(
bool) override;
123 qreal highlightMoveVelocity()
const;
124 void setHighlightMoveVelocity(qreal);
126 qreal highlightResizeVelocity()
const;
127 void setHighlightResizeVelocity(qreal);
129 int highlightResizeDuration()
const;
130 void setHighlightResizeDuration(
int);
132 void setHighlightMoveDuration(
int) override;
134 enum SnapMode { NoSnap, SnapToItem, SnapOneItem };
136 SnapMode snapMode()
const;
137 void setSnapMode(SnapMode mode);
139 enum HeaderPositioning { InlineHeader, OverlayHeader, PullBackHeader };
140 Q_ENUM(HeaderPositioning)
141 HeaderPositioning headerPositioning()
const;
142 void setHeaderPositioning(HeaderPositioning positioning);
144 enum FooterPositioning { InlineFooter, OverlayFooter, PullBackFooter };
145 Q_ENUM(FooterPositioning)
146 FooterPositioning footerPositioning()
const;
147 void setFooterPositioning(FooterPositioning positioning);
149 static QQuickListViewAttached *qmlAttachedProperties(QObject *);
152 void incrementCurrentIndex();
153 void decrementCurrentIndex();
156 void spacingChanged();
157 void orientationChanged();
158 void currentSectionChanged();
159 void highlightMoveVelocityChanged();
160 void highlightResizeVelocityChanged();
161 void highlightResizeDurationChanged();
162 void snapModeChanged();
163 Q_REVISION(2, 4)
void headerPositioningChanged();
164 Q_REVISION(2, 4)
void footerPositioningChanged();
167 void viewportMoved(Qt::Orientations orient) override;
168 void keyPressEvent(QKeyEvent *) override;
169 void geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry) override;
170 void initItem(
int index, QObject *item) override;
171 qreal maxYExtent()
const override;
172 qreal maxXExtent()
const override;
178 Q_PROPERTY(QQuickListView *view READ view NOTIFY viewChanged FINAL)
180 QQuickListViewAttached(QObject *parent)
181 : QQuickItemViewAttached(parent), m_sectionItem(
nullptr) {}
182 ~QQuickListViewAttached() {}
183 QQuickListView *view()
const {
return m_view; }
184 void setView(QQuickListView *view) {
185 if (view != m_view) {
187 Q_EMIT viewChanged();
192 QPointer<QQuickItem> m_sectionItem;
194 QPointer<QQuickListView> m_view;
bool contains(qreal x, qreal y) const override
FxListItemSG(QQuickItem *i, QQuickListView *v, bool own)
qreal itemPosition() const
QQuickItem * section() const
qreal position() const override
qreal endPosition() const override
qreal size() const override
qreal sectionSize() const override
void setSection(QQuickItem *s)
void setPosition(qreal pos, bool immediate=false, bool resetInactiveAxis=true)
MutableModelIterator(QQmlInstanceModel *model, int iBegin, int iEnd)
void releaseSectionItem(QQuickItem *item)
QQuickItem * sectionCache[sectionCacheSize]
void createHighlight(bool onDestruction=false) override
void visibleItemsChanged() override
bool hasStickyHeader() const override
std::unique_ptr< QSmoothedAnimation > highlightWidthAnimator
static void setSectionHelper(QQmlContext *context, QQuickItem *sectionItem, const QString §ion)
FxViewItem * snapItemAt(qreal pos)
QQuickListView::Orientation orient
void updateInlineSection(FxListItemSG *)
void updateSections() override
bool headerNeedsSeparateFixup
qreal originPosition() const override
QQuickListView::FooterPositioning footerPositioning
void fixupPosition() override
QString sectionAt(int modelIndex)
void updateSectionCriteria() override
qreal snapPosAt(qreal pos)
void initializeComponentItem(QQuickItem *item) const override
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &oldGeometry) override
void updateHeader() override
QQuickItem * nextSectionItem
void layoutVisibleItems(int fromModelIndex=0) override
qreal desiredViewportPosition
void fixupHeaderCompleted()
QQuickItem * currentSectionItem
qreal endPositionAt(int index) const override
QString nextStickySection
void updateHighlight() override
void setPosition(qreal pos) override
qreal lastPosition() const override
std::unique_ptr< QSmoothedAnimation > highlightHeightAnimator
bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) override
void adjustFirstItem(qreal forwards, qreal backwards, int) override
void repositionPackageItemAt(QQuickItem *item, int index) override
void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override
bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList< FxViewItem * > *addedItems, QList< MovedItem > *movingIntoView) override
void changedVisibleIndex(int newIndex) override
bool releaseItem(FxViewItem *item, QQmlInstanceModel::ReusableFlag reusableFlag) override
QQuickViewSection * sectionCriteria
bool showFooterForIndex(int index) const override
FxViewItem * newViewItem(int index, QQuickItem *item) override
void resetHighlightPosition() override
qreal footerSize() const override
bool desiredHeaderVisible
QString lastVisibleSection
bool wantsPointerEvent(const QPointerEvent *event) override
void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override
bool isRightToLeft() const
bool showHeaderForIndex(int index) const override
void initializeCurrentItem() override
QQuickListView::HeaderPositioning headerPositioning
qreal fixupHeaderPosition
void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) override
void initializeViewItem(FxViewItem *item) override
bool hasStickyFooter() const override
int highlightResizeDuration
qreal positionAt(int index) const override
bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, QQuickTimeLineCallback::Callback fixupCallback, QEvent::Type eventType, qreal velocity) override
qreal highlightResizeVelocity
void updateCurrentSection()
void updateStickySections()
QString currentStickySection
void updateFooter() override
FxViewItem * itemBefore(int modelIndex) const
static const int sectionCacheSize
void releaseSectionItems()
QQuickItemViewAttached * getAttachedObject(const QObject *object) const override
bool movingFromHighlight() override
void resetFirstItemPosition(qreal pos=0.0) override
bool isBottomToTop() const
bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) override
std::unique_ptr< QSmoothedAnimation > highlightPosAnimator
qreal highlightMoveVelocity
QQuickItem * getSectionItem(const QString §ion)
void removeItem(FxViewItem *item)
bool isContentFlowReversed() const override
QQuickListView::SnapMode snapMode
qreal headerSize() const override
void clear(bool onDestruction) override
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
#define QML_FLICK_SNAPONETHRESHOLD
QT_REQUIRE_CONFIG(quick_listview)