aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmllistmodel_p_p.h
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2025-08-22 09:33:17 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2025-08-22 09:33:17 +0300
commitc6fdadd916a7568c1d71b750e054ca9aa2fd5dfc (patch)
treebbd5690b38a5e0df66dd070a9e9f42b0d1b2b673 /src/qmlmodels/qqmllistmodel_p_p.h
parenta7c766a9863605eb81e8f0cdb4d2b93e087b5bde (diff)
parente436dad999060b92965291b45c0e95a3b93f5866 (diff)
Merge tag 'v6.2.13-lts' into tqtc/lts-6.2-opensourcev6.2.13-lts-lgpl6.2
Qt 6.2.13-lts release Conflicts solved: dependencies.yaml Change-Id: I3cbe1ce4293179888e236dd1a3a299cd2c66c950
Diffstat (limited to 'src/qmlmodels/qqmllistmodel_p_p.h')
-rw-r--r--src/qmlmodels/qqmllistmodel_p_p.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/qmlmodels/qqmllistmodel_p_p.h b/src/qmlmodels/qqmllistmodel_p_p.h
index 19cba980f4..da04b0a5f5 100644
--- a/src/qmlmodels/qqmllistmodel_p_p.h
+++ b/src/qmlmodels/qqmllistmodel_p_p.h
@@ -161,13 +161,23 @@ struct ModelObject : public QObjectWrapper {
{
QObjectWrapper::init(object);
m_model = model;
- QObjectPrivate *op = QObjectPrivate::get(object);
- m_nodeModelMetaObject = static_cast<ModelNodeMetaObject *>(op->metaObject);
}
- void destroy() { QObjectWrapper::destroy(); }
- int elementIndex() const { return m_nodeModelMetaObject->m_elementIndex; }
- QQmlListModel *m_model;
- ModelNodeMetaObject *m_nodeModelMetaObject;
+
+ void destroy()
+ {
+ m_model.destroy();
+ QObjectWrapper::destroy();
+ }
+
+ int elementIndex() const {
+ if (const QObject *o = object()) {
+ const QObjectPrivate *op = QObjectPrivate::get(o);
+ return static_cast<ModelNodeMetaObject *>(op->metaObject)->m_elementIndex;
+ }
+ return -1;
+ }
+
+ QV4QPointer<QQmlListModel> m_model;
};
}
@@ -177,8 +187,6 @@ struct ModelObject : public QObjectWrapper
V4_OBJECT2(ModelObject, QObjectWrapper)
V4_NEEDS_DESTROY
- ListModel *listModel() const { return d()->m_model->m_listModel; }
-
protected:
static bool virtualPut(Managed *m, PropertyKey id, const Value& value, Value *receiver);
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);