Hi,
Please, is there a way to delete an object without passing by RAddObjectsOperation as setCustomProperty.
We want this in purpose that when we delete an object, it doesn't register as operation, and undo/redo won't take it in consideration.
Thanks.
Delete object without passing by RAddObjectsOperation
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Delete object without passing by RAddObjectsOperation
No, you should never change or delete objects directly, bypassing transactions and the undo / redo mechanism.
(Unless, perhaps when you are operating on an off-screen document without any user interaction).
Imagine this simple use case:
Step 1: line added (recorded as transaction, can be undone)
Step 2: line deleted (not recorded, cannot be undone)
Step 3: user hits undo
This would lead to a crash when trying to undo step 1, since the line referenced in step 1 has vanished and its deletion was not recorded. Normally, that line would have been restored when undoing step 2.
(Unless, perhaps when you are operating on an off-screen document without any user interaction).
Imagine this simple use case:
Step 1: line added (recorded as transaction, can be undone)
Step 2: line deleted (not recorded, cannot be undone)
Step 3: user hits undo
This would lead to a crash when trying to undo step 1, since the line referenced in step 1 has vanished and its deletion was not recorded. Normally, that line would have been restored when undoing step 2.
Re: Delete object without passing by RAddObjectsOperation
I see. Thanks for your example.