Results 1 to 6 of 6

Thread: Implement Undo Redo

  1. #1
    Join Date
    Mar 2006
    Location
    Vadodara, Gujarat, India
    Posts
    65
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Implement Undo Redo

    hi all,
    i hav to implement undo and redo functionality in my project. The purpose is to cancel (undo) or redo some actions of cut copy paste etc. are there some existing functions for this. or i hav to make my own.

    ne ideas ???
    Do what u r afraid to do, and the death of fear is sure.

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Implement Undo Redo

    What actually you want do with "Undo", "Redo" buttons?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Implement Undo Redo

    Qt Solutions: Undo/Redo Framework

    And there is a design pattern called Command which fits for undo/redo purposes.

  4. The following user says thank you to jpn for this useful post:

    ankurjain (28th March 2006)

  5. #4
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Implement Undo Redo

    ankurjain, if you wnat to do it manually, I did it in a photo editor. I used a list of "identificators" of the operators that the user has executed.

  6. #5
    Join Date
    Mar 2006
    Location
    Vadodara, Gujarat, India
    Posts
    65
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Implement Undo Redo

    hi zlatko,

    i m having a table. if i cut the contents of the table on undo it must paste back the contents in it. on redo it must again cut. such operations that are generally done on excel file.

    hi SkripT,

    can u explain a bit by code, how u did it.
    Do what u r afraid to do, and the death of fear is sure.

  7. #6
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Implement Undo Redo

    Quote Originally Posted by ankurjain
    hi SkripT,

    can u explain a bit by code, how u did it.
    I think that could be more complex ways to do it, but what I do is everytime that the user executes an action that can be "undoned" I insert its identificator (I have an enum with all the identificator for all the actions) in a QList that I use it like a queue of operators. As you may notice you need also a list for each kind of variables that you enter in each action to execute it. Then when the user wants to undo the last operation, what I do is execute again all the operations in the list till the last operation. How this could be lengthy what I do is clear the list of operations after some operations. I repeat that I use it for a photo editor maybe in your case could differ
    Last edited by SkripT; 28th March 2006 at 14:59.

Similar Threads

  1. Ideas about how to implement Undo and Redo actions?
    By pir in forum General Discussion
    Replies: 3
    Last Post: 21st July 2006, 09:27
  2. Detecting a action ( undo/ redo)
    By ankurjain in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2006, 05:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.