Another trivial step

Yesterday I was able to save only one graphics item i.e. one point only whenever a file was saved. I implemented the saving of all the points in the graphics scene. I thought so! But on opening the file I figured that the number of points saved in the file was equal to number of points in the graphics scene but all of them had the same coordinates.

The coordinates were those of the last point that was painted in the scene. So the thing is I am able to fetch the points in the graphics scene. The update function needs amendment due to which only the coordinates of last point are remembered by the application memory.

I am also able to read the file that was previously saved. The next thing also to be considered is how the data of the graphics item i.e. point for now, would be passed so that the corresponding points are painted in the scene.

In order to implement file handling here, I am deploying class QTextStream. The graphics item in the scene are saved in a QList which is later iterated to stream data to the file. The items() function of QGraphicsScene has been used to create a list of graphics items in the scene.

In my coming posts too, I will be mentioning about various classes and functions of Qt that will be employed in the development.

Cheers!

Leave a Reply

Follow

Get notified with the latest posts

Plugin Supporter WordPress Post Navigation
%d bloggers like this: