StatusQ(ObjectProxyModel): const_cast removed from proxyObject method

Closes: #15744
This commit is contained in:
Michał Cieślak 2024-07-23 17:18:09 +02:00 committed by Michał
parent 6b04e52cf0
commit 44d04bb514
2 changed files with 2 additions and 9 deletions

View File

@ -40,8 +40,7 @@ public:
void setExposedRoles(const QStringList& exposedRoles);
const QStringList& exposedRoles() const;
Q_INVOKABLE QObject* proxyObject(int index);
const QObject* proxyObject(int index) const;
Q_INVOKABLE QObject* proxyObject(int index) const;
signals:
void delegateChanged();

View File

@ -162,7 +162,7 @@ const QStringList& ObjectProxyModel::exposedRoles() const
return m_exposedRoles;
}
QObject* ObjectProxyModel::proxyObject(int index)
QObject* ObjectProxyModel::proxyObject(int index) const
{
if (index >= m_container.size())
return nullptr;
@ -177,7 +177,6 @@ QObject* ObjectProxyModel::proxyObject(int index)
? creationContext : m_delegate->engine()->rootContext();
auto context = new QQmlContext(parentContext);
auto rowData = new QQmlPropertyMap(context);
auto model = sourceModel();
@ -207,11 +206,6 @@ QObject* ObjectProxyModel::proxyObject(int index)
return instance;
}
const QObject* ObjectProxyModel::proxyObject(int index) const
{
return const_cast<ObjectProxyModel*>(this)->proxyObject(index);
}
void ObjectProxyModel::resetInternalData()
{
QIdentityProxyModel::resetInternalData();