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
qquickgridview_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 QQUICKGRIDVIEW_P_H
6#define QQUICKGRIDVIEW_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 <QtQuick/private/qtquickglobal_p.h>
20
22
24
26
29class Q_QUICK_EXPORT QQuickGridView : public QQuickItemView
30{
31 Q_OBJECT
32 Q_DECLARE_PRIVATE(QQuickGridView)
33
34 Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
35 Q_PROPERTY(qreal cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged)
36 Q_PROPERTY(qreal cellHeight READ cellHeight WRITE setCellHeight NOTIFY cellHeightChanged)
37
38 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged)
39
40 Q_CLASSINFO("DefaultProperty", "data")
41 QML_NAMED_ELEMENT(GridView)
42 QML_ADDED_IN_VERSION(2, 0)
43 QML_ATTACHED(QQuickGridViewAttached)
44
45public:
46 enum Flow {
47 FlowLeftToRight = LeftToRight,
48 FlowTopToBottom = TopToBottom
49 };
50 Q_ENUM(Flow)
51
52 QQuickGridView(QQuickItem *parent=nullptr);
53
54 void setHighlightFollowsCurrentItem(bool) override;
55 void setHighlightMoveDuration(int) override;
56
57 Flow flow() const;
58 void setFlow(Flow);
59
60 qreal cellWidth() const;
61 void setCellWidth(qreal);
62
63 qreal cellHeight() const;
64 void setCellHeight(qreal);
65
66 enum SnapMode { NoSnap, SnapToRow, SnapOneRow };
67 Q_ENUM(SnapMode)
68 SnapMode snapMode() const;
69 void setSnapMode(SnapMode mode);
70
71 static QQuickGridViewAttached *qmlAttachedProperties(QObject *);
72
73public Q_SLOTS:
74 void moveCurrentIndexUp();
75 void moveCurrentIndexDown();
76 void moveCurrentIndexLeft();
77 void moveCurrentIndexRight();
78
79Q_SIGNALS:
80 void cellWidthChanged();
81 void cellHeightChanged();
82 void highlightMoveDurationChanged();
83 void flowChanged();
84 void snapModeChanged();
85
86protected:
87 void viewportMoved(Qt::Orientations) override;
88 void keyPressEvent(QKeyEvent *) override;
89 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
90 void initItem(int index, QObject *item) override;
91};
92
94{
95 Q_OBJECT
96 Q_PROPERTY(QQuickGridView *view READ view NOTIFY viewChanged FINAL)
97public:
101 QQuickGridView *view() const { return m_view; }
103 if (view != m_view) {
104 m_view = view;
106 }
107 }
108private:
110};
111
112
113QT_END_NAMESPACE
114
115#endif // QQUICKGRIDVIEW_P_H
qreal footerSize() const override
bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) override
qreal snapPosAt(qreal pos) const
void fixupPosition() override
void updateViewport() override
void updateHighlight() override
bool showFooterForIndex(int index) const override
bool isContentFlowReversed() const override
bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, QQuickTimeLineCallback::Callback fixupCallback, QEvent::Type eventType, qreal velocity) override
void repositionPackageItemAt(QQuickItem *item, int index) override
bool showHeaderForIndex(int index) const override
bool needsRefillForAddedOrRemovedIndex(int index) const override
void createHighlight(bool onDestruction=false) override
QSmoothedAnimation * highlightYAnimator
void initializeViewItem(FxViewItem *item) override
void removeItem(FxViewItem *item)
qreal positionAt(int index) const override
void updateFooter() override
qreal endPositionAt(int index) const override
void setPosition(qreal pos) override
QQuickItemViewAttached * getAttachedObject(const QObject *object) const override
void resetFirstItemPosition(qreal pos=0.0) override
bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList< FxViewItem * > *addedItems, QList< MovedItem > *movingIntoView) override
void initializeComponentItem(QQuickItem *item) const override
void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) override
qreal rowPosAt(int modelIndex) const
void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) override
FxViewItem * snapItemAt(qreal pos) const
void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override
void resetHighlightPosition() override
void changedVisibleIndex(int newIndex) override
void layoutVisibleItems(int fromModelIndex=0) override
qreal contentYForPosition(qreal pos) const
qreal lastPosition() const override
FxViewItem * newViewItem(int index, QQuickItem *item) override
qreal contentXForPosition(qreal pos) const
qreal headerSize() const override
qreal originPosition() const override
void updateHeader() override
bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) override
qreal colPosAt(int modelIndex) const
void initializeCurrentItem() override
QSmoothedAnimation * highlightXAnimator
#define QML_FLICK_SNAPONETHRESHOLD
QT_REQUIRE_CONFIG(quick_gridview)