Need help on Qt Undo framework

  • Hi,

    I want to implement Qt undo/redo framework in my project. I have a QGridLayout with 6 QComboBoxes and a QLineEdit and a few labels arranged properly. Now when user modifies value of lineedit or combobox, I need to capture the changes and have to provide undo/redo option for the values.

    Please let me know how to start with this feature. Since we need to push QUndoCommand do we need to have all the widgets and their values inherited from QUndoCommand.

    Kindly share your views. Thanks in advance.

    Best regards,

  • Lifetime Qt Champion


    It all depends on how things are related between your widgets. Did you already looked at the "Undo Framework Example" ?

  • Thanks for ur reply. Yes, I went thru the Undo framework example.
    My feature requirement is simple, I have widgets and associated signals and slots which is done and fine. Now any user changes to widgets values, I want to enable undo/redo options accordingly.

  • Lifetime Qt Champion

    Then if it's just a question of setting some values back, you can create a QUndoCommand derived class for each type of widget and you should be good to go.

Log in to reply

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