Yeah it involved struggle

Implementing move command only for line was not easy, albeit it has a glitch still but most of the important necessary things have been done.

The issues I faced include:

  1. setPos() function just with a single parameter viz. the scene position did all well. Undo redo had no issue. Though on undo, it quickly jumped to the very first position when it was initially added into the drawing area, which is quite not acceptable.
  2. The undo stack showed the changed position of the line in terms of its local coordinates. Well, we never wanted too. The scene position, preferably, should be shown in the undo stack for convenience.
  3. If the line is displaced from its original position and subsequently the file is saved, again we saw there were the coordinates of the very initial position when it was created in scene in first place.

The first still doesn’t make sense to me yet since a similar implementation in redo is working decently. For obtaining appropriate information for move operation on line, I followed constructor over-riding. The way the things were pushed on to the stack had also to be modified. Constructor over-riding did it in combination with a li’l hacks I had to do at a few places in order to obtain the desired results.

Similarly, saving the correct coordinates for line after is moved also was deployed with a li’l trick. Adding the current scene position to the original local position gave fruitful results while saving the file. The correct implementation for circle and ellipse is under development. 😀

Moving further

The day started with fixing of issue #50 out of the 4 issues I mentioned yesterday. To have a track of mouse position in the drawing area is helpful to the user. Previously, the eventfilter has been deployed on the entire eCAD window. However, it was required to be working only when mouse was in the drawing area.

Fixed the issue by installing the eventfilter on scene using
view->scene->installEventFilter(this);

And then it was time when everyone present was installing eCAD and reporting issues. Felt more responsibility towards my project. The journey has been awesome till now.

Meanwhile, we continued comprehending the solution to implemenatation of undo/redo for move command. Someone has been pointing me out to use the same logic as it has been done for point entity and I didn’t take much notice considering it to be inappropriate.

From creating a logic to push different number of arguments to the undoStack, I figured the coordinates being local to the entity created, I moved onto understanding the mapToScene() which returns a point’s value in terms of scene coordinates which is required right now. And this would saving so much of redundant efforts we have been thinking that could get involved.

Will be continuing keeping track of various issues and the features in the to do list.