QQmlProperty loses data
-
Hello,
I read some data from my database and create a model instance from that data.
One attribute on that class is aQQmlPropertyMap
. After returning the created model instance from the function where I read the data and create the instance, the data inside theQQmlPropertyMap
is lost.I assume the reason for that is, that the
QQmlPropertyMap
data is actually aQScopedPointer
as seen in the screenshot below:
How can I keep the
QQmlPropertyMap
populated when I return the surrounding object from my function?What exactly am I doing?
// read data from database happened prior in this function QQmlPropertyMap* airEjMapping = createQQmlPropertyMapFromString( m->getAttribute("airEjectionMapping").value<QString>()); // Create object Mp* mp = new Mp(m->getAttribute("id").value<qint32>(), airEjMapping); return mp; // Mp ctor Mp::Mp(const qint32 id, QQmlPropertyMap* airEjMapping : m_id(id) { // I save the QQmlProperty as QSharedPointer m_airEjectionMapping.reset(airEjMapping); }
After returning the contents of that property looks like this
Now, how am I supposed to pass my model through my application without losing data?