when undo, how can get type of entity?

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
liguosheng
Active Member
Posts: 33
Joined: Thu Jan 14, 2016 4:17 am

when undo, how can get type of entity?

Post by liguosheng » Fri Oct 07, 2016 11:36 am

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!

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

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

Post by andrew » Fri Oct 07, 2016 12:21 pm

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).

liguosheng
Active Member
Posts: 33
Joined: Thu Jan 14, 2016 4:17 am

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

Post by liguosheng » Fri Oct 07, 2016 2:03 pm

if a block is deleted, then undo, can the name of block be got? how? thanks!

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

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

Post by andrew » Fri Oct 07, 2016 4:40 pm

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.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”