Clear undo stack

Discussion forum for contributors and developers who are using the QCAD version 3 ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

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

Clear undo stack

Postby 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: 4129
Joined: Fri Mar 30, 2007 6:07 am

Re: Clear undo stack

Postby 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

Postby 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: 4129
Joined: Fri Mar 30, 2007 6:07 am

Re: Clear undo stack

Postby andrew » Thu Feb 13, 2014 10:49 am

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


Return to “QCAD 3 Developers and Contributors”

Who is online

Users browsing this forum: No registered users and 1 guest