Results 1 to 2 of 2

Thread: Achieve to undo/redo stack from widgets....¿posible?

  1. #1
    Join Date
    Jan 2015
    Qt products

    Default Achieve to undo/redo stack from widgets....¿posible?

    This is my question. I have a widget with a undo button and a redo button and two QtextEdit.
    I can call to the undo()/redo() methods from each QTextEdit and executing this actions in one or other widget, but I would like to store the actions for both of them.

    I mean that if I change QtextEdit 1, and next I change QTextEdit2 and finally I change again QTextEdit1, I would like that if I press Undo button three times then it undoes second change of QtextEdit 1, after it undoes QTextEdit 2 changes and finally it undoes first change of QTextEdit 1 .

    I think that there are two ways for get it:

    1.- Create all the necessaries commands I want to push (I see it tedious and obligate me to do again a work that exist into the QTextEdit) or...
    2.- Use the undo/redo stack from the widgets (the QTextEdit) for get the commands and use in my main undoStack, but looks that there aren't any method for access to stacks.

    My question is:

    ¿Is possible the things I say? (access to the stack from QTextEdit -or other widget- for push this commands in a "main" stack)

    If not....¿may I define each action I want to add to QUndoStack?

  2. #2
    Join Date
    Jan 2012
    Dortmund, Germany
    Thanked 10 Times in 8 Posts
    Qt products
    Windows Android

    Default Re: Achieve to undo/redo stack from widgets....¿posible?

    As there seems to be no information about the number of possible undos/redos while the user is inputting, I don't see a way to properly monitor the changes and afterwards dispatch the undo/redo without. With looking into the source code of QTextEdit you might find ideas, but I think you'll probably have to implement this by yourself.

Similar Threads

  1. OpenGL Undo/Redo
    By romzxlat in forum Newbie
    Replies: 1
    Last Post: 27th March 2015, 12:01
  2. Replies: 0
    Last Post: 21st January 2014, 07:05
  3. qt undo/redo
    By giugio in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2012, 17:31
  4. Syncing QTextDocument's undo stack with custom undo stack
    By Dini Selimović in forum Newbie
    Replies: 0
    Last Post: 24th June 2012, 14:11
  5. Implement Undo Redo
    By ankurjain in forum Qt Programming
    Replies: 5
    Last Post: 28th March 2006, 14:17


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.