Page 1 of 1

when undo, how can get type of entity?

Posted: Fri Oct 07, 2016 11:36 am
by liguosheng
when an entity is selected, its' type can be acquired easily. However, when an entity is undid or redid(in the 'Edit' menu), how to get its' type? Thanks!

Re: when undo, how can get type of entity?

Posted: Fri Oct 07, 2016 12:21 pm
by andrew
The undone status is just a flag of the object (entity in this case). You can get it the same way as for a regular entity (getType or through dynamic_cast).

Re: when undo, how can get type of entity?

Posted: Fri Oct 07, 2016 2:03 pm
by liguosheng
if a block is deleted, then undo, can the name of block be got? how? thanks!

Re: when undo, how can get type of entity?

Posted: Fri Oct 07, 2016 4:40 pm
by andrew
If you want to be notified the deletion of a block, you'd best implement an RTransactionListener. You can find an example at: https://github.com/qcad/qcad/blob/maste ... istener.js

Transaction listeners are notified whenever 'something changes' (object added, object modified, object deleted), also during undo / redo.