QML Serialization
-
I have to serialize whole scene rendered with QDeclarativeView, what's the best approach?
Do I have to write it from a scratch? -
Sure:
I have a QML application in which I create 2D boxes (Rectangles) - each box can be opened and contain other boxes and so on - now I need to save the whole box-tree into a file, so I could load and reuse it later.
I couldn't find anything about serialization in QML - do I have to write own parser in C++ which would read my QML tree or is there any easier way? -
I think you have to write from scratch. There is a QDataStream class in Qt which helps creating your own binary serialization. I think most basic Qt types support QDataStream. Check out QObject::children() and QDeclarativeView::rootObject. Goot luck, would be nice to hear about your solution.