Clear undo stack

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
sramp
Active Member
Posts: 26
Joined: Mon Dec 02, 2013 4:15 pm

Clear undo stack

Post by sramp » Tue Feb 11, 2014 5:27 pm

Hello,
I'm building a custom tool and to help the user the tool creates some construction lines ( RLineEntity ). These lines will be deleted at the end by the script.
The tool works as expected, but I have some problems with the undo command, since I got a crash.
I suppose that references of construction lines are still in the undo stack.
Is there a way to reset the undo stack in a safe state?
Thanks
sramp

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

Re: Clear undo stack

Post by andrew » Wed Feb 12, 2014 9:38 am

If you create and delete everything in operations (RAddObjectsOperation, RDeleteObjectsOperation, ...), this should never be an issue.
Perhaps, you can post the relevant part of your code?

sramp
Active Member
Posts: 26
Joined: Mon Dec 02, 2013 4:15 pm

Re: Clear undo stack

Post by sramp » Thu Feb 13, 2014 10:26 am

There is an error in my logic and this is the real cause of the problem.

I create some lines ( undoable true )
....
I delete the lines ( undoable false )

If I set as undoable every operation everything works fine.
I could set not undoable the lines creation too, but this makes the tools less usable during the lines creation.

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

Re: Clear undo stack

Post by andrew » Thu Feb 13, 2014 10:49 am

Yes, undoable should actually always be true unless a file is being loaded.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”