Pass object pointer throught c++ dataModel
-
Hi,
I'm writting a C++ dataModel. I follow the documentation provided, so derived from QAbstractListModel. I defiend some role, one of them must be a pointer to a register type. But by passing throught the Qvariant, the QML side lose the type and it never recognise the true type.
Did you have a solution or an idea ?Thanks
-
Hello,
Did you read this article "article":http://cdumez.blogspot.fr/2010/11/how-to-use-c-list-model-in-qml.html ?
It was very helpfull for me! -
Thanks for the link, but I have no problem with this part. I just can't make it work when a property has pointer to register type for type. Due to QVariant which store a void* instread of Type*
-
Did you use qmlRegisterType ?
-
What I call a register type is a type on which I've used qmlRegisterType. So yes.
The main purpose is to expose in a dataModel a type, which is an associative array like a QHash<QString, QVariant>. -
I have done the same thing and it works fine, so could you post some code?