0
votes

I am working on an application using Qt5 in which you can free hand draw arbitrary shapes in vector graphics, move them and and partially remove parts (just like an eraser in Microsoft paint).

I draw the shapes in QGraphicsScene by adding QGraphicsPathItem and move them using the QGraphicsItem::ItemIsMovable flag. The question of the eraser remains.

Has anyone faced the task of partial removal of QGraphicsPathItem? Especially in a situation when we divide the figure into two (or more) parts with an eraser and these should become separate new QGraphicsPathItem ? Is it possible to implement it?

Thanks for any help!

1

1 Answers

0
votes

Coincidentally, I am making a similar application. My app only involves d0freehand drawing. I am using mouse events to add or erase. I started with this and modified it alot. I am keeping a using a selection buffer to select an object and using matrices to move them.

To answer your question, for partially erasing :

  • Divide previous item two items
  • Delete the previous item.
  • Redraw the new items.