QmlMaterial 0.1.0
Loading...
Searching...
No Matches
lazy_row.hpp
1#pragma once
2
3#include "qml_material/model/item_source.hpp"
4
5namespace qml_material
6{
7class QML_MATERIAL_API LazyRow : public QObject {
8 Q_OBJECT
9 QML_ELEMENT
10 QML_UNCREATABLE("Rows are supplied by a lazy view")
11 Q_PROPERTY(int index READ index NOTIFY changed FINAL)
12 Q_PROPERTY(QString key READ key NOTIFY changed FINAL)
13 Q_PROPERTY(QVariant value READ value NOTIFY changed FINAL)
14 Q_PROPERTY(quint64 revision READ revision NOTIFY changed FINAL)
15 Q_PROPERTY(quint64 contentRevision READ contentRevision NOTIFY changed FINAL)
16 Q_PROPERTY(bool active READ active NOTIFY activeChanged FINAL)
17public:
18 using QObject::QObject;
19 int index() const { return m_index; }
20 QString key() const { return m_record.key; }
21 QVariant value() const { return m_record.value; }
22 quint64 revision() const { return m_revision; }
23 quint64 contentRevision() const { return m_record.contentRevision; }
24 bool active() const { return m_active; }
25 void bind(const ItemSnapshotPtr&, int index);
26 void pool();
27 Q_SIGNAL void changed();
28 Q_SIGNAL void activeChanged();
29 Q_SIGNAL void pooled();
30 Q_SIGNAL void reused();
31
32private:
33 ItemRecord m_record;
34 int m_index = -1;
35 quint64 m_revision = 0;
36 bool m_active = false;
37 quint64 m_generation = 0;
38};
39} // namespace qml_material