Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Suggestions on undo/redo functionality for an image processing app.
QtWS25 Last Chance

[SOLVED]Suggestions on undo/redo functionality for an image processing app.

Scheduled Pinned Locked Moved General and Desktop
undo framework
5 Posts 2 Posters 888 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ealioneE Offline
    ealioneE Offline
    ealione
    wrote on last edited by ealione
    #1

    I am sort of moving ahead on this project I was trying to do with the double image viewer.

    I am at the point where I want to be able to create a small history of the user's actions.

    Lets say that for example he wants to display the negative of the image he just loaded. He only has to press the "Negative" option from the menu. After the operation is done I want to display an item in a listWidget saying something like "operation negative" or something similar. After a bit the user might have selected a number of other options etc. So the list will slowly start to fill with user actions.

    At any point if he wishes he can click the corresponding list item and be transported at that position (so basically he will get his image as it was at that point).

    Has anyone an idea of an efficient way that I could implement this. Saving the image in ram after each operation seems not all that good of an idea, because after a few operations the program will need a lot of ram to operate. Would saving the image in a temporary file and reloading it be a good idea?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What about cache + temp files ? Keep the last X frames into a cache and then start using the disk ? Also, depending on the operation you do, you can also just save the operation itself, e.g. change blue from 255 to 185, then apply that operation backward.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ealioneE Offline
        ealioneE Offline
        ealione
        wrote on last edited by
        #3

        Hi SGaist,
        As usual yes you helped a lot. I thought about your second suggestion, but those operations could possibly be very complex and might need some time to run. In that case the user will have to wait. Users hate waiting :)
        Moreover, there is no guarantee that there will be a procedure that is able to reverse the algorithm, so we go back at saving frames.

        As for your first suggestion, I have used cache once during the development (ongoing) of my QtServer, but I am not sure on how am I to implement it. For example how will I distinguish each frame, locate it in cache or disk etc. Thus I will have to do some tests and get back at you.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's why, when possible, you give them visual feedbacks of what is happening.

          That's why you should handle each operation the "correct way", meaning that the non-destructive operations can be stored as just command to be reversed, and the other operations should store the original state before the modification.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ealioneE Offline
            ealioneE Offline
            ealione
            wrote on last edited by
            #5

            That sounds indeed like the right way to go, but for the moment it seems a little bit hard to create a container able to store and distinguish between those three methods of saving previous states.

            I think I should start with the simplest of them all, namely cache, and progressively implement the others. So I will store lets say up to 10 frames with a unique id and call them as needed.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved