Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Undo redo for vtk widgets



  • Dear all,

    I read that qt has implemented the undo and redo operations for widgets in qt using the undo stack. I wonder if this class can only be used for vtk widgets. Or I have to implement this option from the beginning as qt does not support this feature for vtk objects.

    Thank you very much



  • What exactly do you want to undo on the VTKWidget, since typically it will just render some data and not provide any data manipulation actions.
    The Undo Framework will store actions and their undo couterparts. This will work in general for any widget no matter if it is VTK or whatever, but you need to implement it yourself.



  • I would like to undo or redo like any other software for example the addition of a widget if I apply an undo to delete it or undo a translation or a rotation of a vtkboxwidget to go to the previous status before the user moved it in the end of interaction or a movement of a control point of the spline to undo the change of the control point to the previous state. I wonder if there was something already implemented such as this undo stack of qt that I can use or i have to implement the undo and redo stacks by myself from the beginning. I checked the vtkundo implemented only in paraview (not a vtk class) and it seems that it will be the case.

    Thanks


  • Lifetime Qt Champion

    Hi,

    Use QUndoStack. You'll have to create your set of commands.



  • @SGaist But this cannot be used for vtk widgets only qt objects. I think it must be implemented from the very beginning as paraview does.


  • Lifetime Qt Champion

    @zandarina why can it not be used with VTK widgets ? The QUndo framework is not tied to any specific widgets type. It's generic.


Log in to reply