-
Notifications
You must be signed in to change notification settings - Fork 68
Deserialize QObject* with parametrized constructor #22
Comments
Not really, no. How would the serializer know what these parameters are? Do you want to deserialize some json properties as arguments for the constructor? More details on your use case might help. If you have a class you cannot modify, I would recommend you to create a wrapper class that takes care of this. |
Thanks for your reply, Now i'm using a wrapper class as you mentioned, to handle these dependencies, but its a little bug prone because classes should have a setter methods rather than constructors. |
It is not possible with the current architecture. However, you can create your own QJsonTypeConverter to handle this situation. Just create one by copying the code from QJsonObjectConverter and then adjust it to work the way you need it to. Just make sure to give it at least a |
Thanks for your help, |
Any success yet? If yes, you can close the issue. If not, I might be able to give further help... |
Actually i tried to redesign some part of my code without using QJsonObjectConverter, because i wanted to keep source code simple for now. |
Hello,
Is it technically possible to have Q_INVOKABLE constructor that takes some parameters when deserializing a QObject ??
The text was updated successfully, but these errors were encountered: