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.


  • 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":

  • [quote author="Franzk" date="1290084294"]Maybe this one helps: "Using Undo/Redo with Item Views":[/quote]

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

Log in to reply

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