3#include "qml_material/scrollable/flickable.hpp"
4#include "qml_material/model/item_source.hpp"
5#include "qml_material/model/item_demand.hpp"
6#include <QQmlComponent>
14class QML_MATERIAL_API LazyView :
public Flickable {
17 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY
18 orientationChanged FINAL)
19 Q_PROPERTY(ItemSource* source READ source WRITE setSource NOTIFY sourceChanged FINAL)
20 Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
22 qreal cacheExtent READ cacheExtent WRITE setCacheExtent NOTIFY cacheExtentChanged FINAL)
23 Q_PROPERTY(
int poolLimit READ poolLimit WRITE setPoolLimit NOTIFY poolLimitChanged FINAL)
25 bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged FINAL)
26 Q_PROPERTY(qreal cachePreparationBudget READ cachePreparationBudget WRITE
27 setCachePreparationBudget NOTIFY cachePreparationBudgetChanged FINAL)
28 Q_PROPERTY(
int pendingCount READ pendingCount NOTIFY layoutChanged FINAL)
29 Q_PROPERTY(
int count READ count NOTIFY countChanged FINAL)
30 Q_PROPERTY(
int firstVisibleIndex READ firstVisibleIndex NOTIFY layoutChanged FINAL)
31 Q_PROPERTY(
int lastVisibleIndex READ lastVisibleIndex NOTIFY layoutChanged FINAL)
32 Q_PROPERTY(
int anchorIndex READ anchorIndex NOTIFY layoutChanged FINAL)
33 Q_PROPERTY(
int liveCount READ liveCount NOTIFY layoutChanged FINAL)
34 Q_PROPERTY(
bool estimatedContentWidth READ estimatedContentWidth NOTIFY layoutChanged FINAL)
35 Q_PROPERTY(
bool estimatedContentHeight READ estimatedContentHeight NOTIFY layoutChanged FINAL)
36 Q_PROPERTY(QString errorString READ errorString NOTIFY layoutChanged FINAL)
37 Q_PROPERTY(
bool positioning READ positioning NOTIFY positioningChanged FINAL)
38 Q_PROPERTY(qml_material::ItemDemand currentDemand READ currentDemand NOTIFY itemsNeeded FINAL)
39 Q_PROPERTY(QString currentKey READ currentKey WRITE setCurrentKey NOTIFY currentChanged FINAL)
40 Q_PROPERTY(
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged FINAL)
49 Qt::Orientation orientation()
const;
50 void setOrientation(Qt::Orientation);
51 Q_SIGNAL
void orientationChanged();
52 ItemSource* source()
const;
53 void setSource(ItemSource*);
54 QQmlComponent* delegate()
const;
55 void setDelegate(QQmlComponent*);
56 qreal cacheExtent()
const;
57 void setCacheExtent(qreal);
58 int poolLimit()
const;
59 void setPoolLimit(
int);
60 bool asynchronous()
const;
61 void setAsynchronous(
bool);
62 qreal cachePreparationBudget()
const;
63 void setCachePreparationBudget(qreal);
64 int pendingCount()
const;
66 int firstVisibleIndex()
const;
67 int lastVisibleIndex()
const;
68 int anchorIndex()
const;
69 int liveCount()
const;
70 bool estimatedContentHeight()
const;
71 bool estimatedContentWidth()
const;
72 QString errorString()
const;
73 Q_INVOKABLE
bool positionAtKey(
const QString&, qreal alignment = 0, qreal offset = 0,
74 PositionMode mode = Immediate);
75 Q_INVOKABLE
bool positionAtIndex(
int index, qreal alignment = 0, qreal offset = 0,
76 PositionMode mode = Immediate);
77 QString currentKey()
const;
78 void setCurrentKey(
const QString&);
79 int currentIndex()
const;
80 void setCurrentIndex(
int);
81 Q_INVOKABLE QString keyAtIndex(
int)
const;
82 Q_INVOKABLE QRectF itemRect(
int)
const;
83 Q_SIGNAL
void currentChanged();
84 ItemDemand currentDemand()
const;
85 Q_SIGNAL
void itemsNeeded(
const qml_material::ItemDemand& demand);
86 bool positioning()
const;
87 void setContentY(qreal)
override;
88 void setContentX(qreal)
override;
89 Q_SIGNAL
void positioningChanged();
90 Q_SIGNAL
void positioningFinished(
const QString& key,
bool success);
91 Q_SIGNAL
void sourceChanged();
92 Q_SIGNAL
void delegateChanged();
93 Q_SIGNAL
void cacheExtentChanged();
94 Q_SIGNAL
void poolLimitChanged();
95 Q_SIGNAL
void asynchronousChanged();
96 Q_SIGNAL
void cachePreparationBudgetChanged();
97 Q_SIGNAL
void countChanged();
98 Q_SIGNAL
void layoutChanged();
101 explicit LazyView(std::unique_ptr<LazyViewLayout>, QQuickItem* parent);
102 LazyViewLayout& layoutEngine()
const;
103 void invalidateLayout();
104 void keyPressEvent(QKeyEvent*)
override;
105 void updatePolish()
override;
106 void componentComplete()
override;
107 void geometryChange(
const QRectF&,
const QRectF&)
override;
108 void viewportMoved(Qt::Orientations)
override;
109 void scrollInputStarted()
override;
110 void scrollActivityCancelled()
override;
113 void notifyCountChanged();
114 void invalidateDemand();
115 void scheduleLayout();
116 void schedulePreparation();
117 void cancelPreparations();
118 void finishPositioning(
bool success);
120 std::shared_ptr<Private> d;