Comments (6)
Thanks for your help,
I'll try to use this approach.
from qtjsonserializer.
Actually i tried to redesign some part of my code without using QJsonObjectConverter, because i wanted to keep source code simple for now.
But it seems using QJsonObjectConverter is a robust approach for future.
I appreciate your help.
from qtjsonserializer.
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.
from qtjsonserializer.
Thanks for your reply,
The main issue is that i want to serialize/deserialize some QObject derived classes but this classes are logically dependent to each other, e.g class2 has a constructor that takes class1 as argument. and i want to serialize these two classes.
For serialization everything is OK but for deserialization after i deserialized class1, i want to pass it to class2 constructor when i'm constructing (desalinizing) class2.
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.
i was wondering maybe its possible to have a none-default constructors for QObjects.
from qtjsonserializer.
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 High
priority, so it is preferred to be used over the standard QObject converter.
from qtjsonserializer.
Any success yet? If yes, you can close the issue. If not, I might be able to give further help...
from qtjsonserializer.
Related Issues (20)
- QHash<int, QString> workaround HOT 2
- It can't convert QSharedPointer successfully.
- How to deserialize derived classes that use none-default constructors HOT 2
- Mac build "make" step giving .reggen errors. Any advice? HOT 2
- Add module fail HOT 1
- Using multiple instances in Qt subdir HOT 3
- Q_GADGET and QVariantList HOT 1
- Deserialization QPair within QVariant
- Cannot find missing dependency "qt.qt5.5130.android_arm64_v8a" ...
- Runtime exception occurred in sample.
- Sample: SerializationException (Unable to determine typeid of meta enum SampleObject::SuperFlags) HOT 1
- Converting QtJsonSerializer from QMake to CMake HOT 1
- Add entries in the repository for Qt 5.15.* and 6
- CopperSpice support HOT 2
- head of line cannot run sample application HOT 1
- Can not serialize enum properties HOT 3
- Poor performance for array of PODs with simple properties
- registerSetConverters results in build time error no matching function to call qHash(...
- Deserialize into existing object
- Create references to existing object , not duplicates HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtjsonserializer.