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

Internal Drag'n'Drop (move) in QListView and Undo-Redo



  • Qt supports internal drag'n'drop in QListView.
    Qt provides good Undo-Redo framework.

    Is it possible to simply integrate these two features? How to implement internal move (drag'n'drop in the same list) with undo-redo support?

    I know how to do this "from scratch", I am looking for pretty solution.

    Thanks.



  • Try taking these steps:

    Implement the internal drag & drop. Make sure it does what you need.

    Define undo/redo points & actions

    Add undo/redo stack to model

    Add interface & GUI for undo/redo

    When the same model also supports moving data from one to another model, you should take a more complex approach, possibly with the undo stack in the top-level widget. Important thing is to learn to use them separately before you integrate them. It helps you keep overview of things. Make a small application that uses the undo stack in a different context so you get a proper feel for how it works.



  • Ok, thanks for the reply.

    I think almost in the same way, but expect that simpler integration may be possible.

    Internal move is deeply integrated in the model and view class, so some workarounds are required.



  • Maybe this one helps: "Using Undo/Redo with Item Views":http://doc.trolltech.com/qq/qq25-undo.html.



  • [quote author="Franzk" date="1290084294"]Maybe this one helps: "Using Undo/Redo with Item Views":http://doc.trolltech.com/qq/qq25-undo.html.[/quote]

    Thank you. Not exactly what I want, but very good article. Idea of using Proxy models is intersecting.


Log in to reply