aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmldelegatemodel_p_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlmodels/qqmldelegatemodel_p_p.h')
-rw-r--r--src/qmlmodels/qqmldelegatemodel_p_p.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel_p_p.h b/src/qmlmodels/qqmldelegatemodel_p_p.h
index 367504d7fc..1eff54162a 100644
--- a/src/qmlmodels/qqmldelegatemodel_p_p.h
+++ b/src/qmlmodels/qqmldelegatemodel_p_p.h
@@ -37,12 +37,22 @@ typedef QQmlListCompositor Compositor;
class QQmlDelegateModelAttachedMetaObject;
class QQmlAbstractDelegateComponent;
+class QQmlTableInstanceModel;
class Q_QMLMODELS_EXPORT QQmlDelegateModelItemMetaType final
: public QQmlRefCounted<QQmlDelegateModelItemMetaType>
{
public:
- QQmlDelegateModelItemMetaType(QV4::ExecutionEngine *engine, QQmlDelegateModel *model, const QStringList &groupNames);
+ enum class ModelKind : quint8 {
+ InstanceModel,
+ DelegateModel,
+ TableInstanceModel,
+ };
+
+ QQmlDelegateModelItemMetaType(
+ QV4::ExecutionEngine *engine, QQmlDelegateModel *model, const QStringList &groupNames);
+ QQmlDelegateModelItemMetaType(
+ QV4::ExecutionEngine *engine, QQmlTableInstanceModel *model);
~QQmlDelegateModelItemMetaType();
void initializeAttachedMetaObject();
@@ -51,12 +61,23 @@ public:
int parseGroups(const QStringList &groupNames) const;
int parseGroups(const QV4::Value &groupNames) const;
- QPointer<QQmlDelegateModel> model;
+ QQmlDelegateModel *delegateModel() const
+ {
+ return modelKind == ModelKind::DelegateModel
+ ? static_cast<QQmlDelegateModel *>(model.get())
+ : nullptr;
+ }
+
qsizetype groupCount() const { return groupNames.size(); }
+
+ void emitModelChanged() const;
+
+ QPointer<QQmlInstanceModel> model;
QV4::ExecutionEngine * const v4Engine;
QQmlRefPointer<QQmlDelegateModelAttachedMetaObject> attachedMetaObject;
const QStringList groupNames;
QV4::PersistentValue modelItemProto;
+ ModelKind modelKind = ModelKind::InstanceModel;
};
class QQmlAdaptorModel;