Hello there,
I need a suggestion about file saving-loading, first of all let me explain my case.
I have a QGraphicsView that showing many items in the Scenes. I need to save these QGraphicsItems into file and then i need to load back into Scenes then show these scenes into QgraphicsView.
I've already done saving data into file which is contains serialized QGraphicsItem as a QDataStream and then de-serialized these data into QGraphicsItems and showing into scenes. I'm keeping these data as like xml format let me show piece of my file format.
<!DOCTYPE NIGHTS>
<view>
<scene index="0">
<shape type="65537">AAAAJ0COMAAAAAAAQHtAAAAAAABAjjAAAAAAAEB7MAAAAAAAQI44AAAAAABAexAAAAAAAECOQAAAAAAAQHsQAAAAAABAjkgAAAAAAEB7AAAAAAAAQI5QAAAAAABAewAAAAAAAECOYAAAAAAAQHrgAAAAAABAjnAAAAAAAEB6sAAAAAAAQI6gAAAAAABAekAAAAAAAECO2AAAAAAAQHnQAAAAAABAjwAAAAAAAEB5UAAAAAAAQI9AAAAAAABAeOAAAAAAAECPaAAAAAAAQHhQAAAAAABAj6gAAAAAAEB3sAAAAAAAQI/YAAAAAABAdvAAAAAAAECQBAAAAAAAQHZwAAAAAABAkBAAAAAAAEB14AAAAAAAQJAgAAAAAABAdXAAAAAAAECQMAAAAAAAQHUAAAAAAABAkCgAAAAAAEB1oAAAAAAAQJAoAAAAAABAdnAAAAAAAECQKAAAAAAAQHeAAAAAAABAkCgAAAAAAEB4sAAAAAAAQJAoAAAAAABAehAAAAAAAECQNAAAAAAAQHtwAAAAAABAkDQAAAAAAEB80AAAAAAAQJA0AAAAAABAfoAAAAAAAECQNAAAAAAAQH+wAAAAAABAkDQAAAAAAECAiAAAAAAAQJA0AAAAAABAgSAAAAAAAECQNAAAAAAAQIGgAAAAAABAkDQAAAAAAECCOAAAAAAAQJA0AAAAAABAgsAAAAAAAECQNAAAAAAAQIMYAAAAAABAkDQAAAAAAECDcAAAAAAAQJA8AAAAAABAg8gAAAAAAECQPAAAAAAAQIQwAAAAAABAkDwAAAAAAECEiAAAAAAAQJA8AAAAAABAhOAAAAAAAD/wAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAChAEAiAAAAAAAAAQH//wAAAAAAAAAAP/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/wAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA/8AAAAAAAAAA/8AAAAAAAAA==</shape>
</scene>
</view>
To copy to clipboard, switch view to plain text mode
So there is element text which is base64 Binary data so i'm easily convertin that data into QDataStream then de-serializing QgraphicsItems.
Now, questions coming , Firstly That approac does make sense to you ? IF it didn't please could you give me better suggestion i can follow.
Second question when i save the QgraphicsItems into file or Loading back in that steps; as i said before, there is a lot of QGI almost 10k around. My gui is blocking event loop as you guess. But i'm not so experienced with QThreads could you give me clue, how can i pass data from Worker thread to Gui thread, in my situation.
Thanks, any suggestion is welcomed.
Bookmarks