17 #ifndef ABSTRACTDASHVIEW_H
18 #define ABSTRACTDASHVIEW_H
22 class QAbstractItemModel;
24 #pragma GCC diagnostic push
25 #pragma GCC diagnostic ignored "-pedantic"
26 #include <private/qqmldelegatemodel_p.h>
28 #pragma GCC diagnostic pop
30 class AbstractDashView :
public QQuickItem
34 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged)
35 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
36 Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
37 Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
38 Q_PROPERTY(qreal delegateCreationBegin READ delegateCreationBegin
39 WRITE setDelegateCreationBegin
40 NOTIFY delegateCreationBeginChanged
41 RESET resetDelegateCreationBegin)
42 Q_PROPERTY(qreal delegateCreationEnd READ delegateCreationEnd
43 WRITE setDelegateCreationEnd
44 NOTIFY delegateCreationEndChanged
45 RESET resetDelegateCreationEnd)
47 friend class VerticalJournalTest;
48 friend class HorizontalJournalTest;
49 friend class OrganicGridTest;
54 QAbstractItemModel *model()
const;
55 void setModel(QAbstractItemModel *model);
57 QQmlComponent *delegate()
const;
58 void setDelegate(QQmlComponent *delegate);
60 qreal columnSpacing()
const;
61 void setColumnSpacing(qreal columnSpacing);
63 qreal rowSpacing()
const;
64 void setRowSpacing(qreal rowSpacing);
66 qreal delegateCreationBegin()
const;
67 void setDelegateCreationBegin(qreal);
68 void resetDelegateCreationBegin();
70 qreal delegateCreationEnd()
const;
71 void setDelegateCreationEnd(qreal);
72 void resetDelegateCreationEnd();
76 void delegateChanged();
77 void columnSpacingChanged();
78 void rowSpacingChanged();
79 void delegateCreationBeginChanged();
80 void delegateCreationEndChanged();
86 void updatePolish()
override;
87 void componentComplete()
override;
89 void releaseItem(QQuickItem *item);
90 void setImplicitHeightDirty();
93 void itemCreated(
int modelIndex, QObject *
object);
94 void onModelUpdated(
const QQmlChangeSet &changeSet,
bool reset);
95 void onHeightChanged();
98 void createDelegateModel();
100 bool addVisibleItems(qreal fillFromY, qreal fillToY,
bool asynchronous);
101 QQuickItem *createItem(
int modelIndex,
bool asynchronous);
103 virtual void findBottomModelIndexToAdd(
int *modelIndex, qreal *yPos) = 0;
104 virtual void findTopModelIndexToAdd(
int *modelIndex, qreal *yPos) = 0;
105 virtual void addItemToView(
int modelIndex, QQuickItem *item) = 0;
106 virtual bool removeNonVisibleItems(qreal bufferFromY, qreal bufferToY) = 0;
107 virtual void cleanupExistingItems() = 0;
108 virtual void doRelayout() = 0;
109 virtual void updateItemCulling(qreal visibleFromY, qreal visibleToY) = 0;
110 virtual void calculateImplicitHeight() = 0;
111 virtual void processModelRemoves(
const QVector<QQmlChangeSet::Remove> &removes) = 0;
113 QQmlDelegateModel *m_delegateModel;
116 int m_asyncRequestedIndex;
120 qreal m_delegateCreationBegin;
121 qreal m_delegateCreationEnd;
122 bool m_delegateCreationBeginValid;
123 bool m_delegateCreationEndValid;
124 bool m_needsRelayout;
125 bool m_delegateValidated;
126 bool m_implicitHeightDirty;