Undo/redo problem[solved]



  • hi, i'm having a problem implimenting undo with QUndoStack and QUndoCommand
    i created the @QAction *undoAction; @

    in the header file,and in the constructer i did this
    @undoAction = undoStack->createUndoAction(this, tr("&Undo"));@

    then push a command into the stack "i know that the command got pushed because i saw it with the debuger"

    but when i run the program and press undo the function that i implimented in the command::undo() doesn't get excuted
    but when i call
    @undoStack->undo();@

    using an other button the function that i implimented in the command::undo() excutes

    i hope my question makes sens ,and i will provide any other details


  • Lifetime Qt Champion

    Hi,

    Can you post your Qt/OS versions ?



  • ok,sorry that i bothered you
    but i solved the problem,the problem was that, in the constructer i allocated the undoStack two times
    @ undoStack = new QUndoStack(this);@

    then
    @ undoStack = new QUndoStack(this);@

    i deleted one and now runs fine


  • Lifetime Qt Champion

    No worries and thanks for sharing the solution !

    Don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.