Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4376 closed defect (fixed)

OMEdit: Undo stack is cleared when the model is saved in TextView

Reported by: Jan Kokert Owned by: Adeel Asghar
Priority: high Milestone: 1.12.0
Component: OMEdit Version:
Keywords: undo stack is cleared Cc:

Description

Since 90da68c/OMEdit the undo stack is cleared when the model is saved. This is quite bothersome and should be fixed asap. Thanks!

Change History (7)

comment:1 by Adeel Asghar, 8 years ago

I guess you probably mean saving when you are in the text view with manual changes in the text. If this is the case then it is duplicate of #4344.

comment:2 by Jan Kokert, 8 years ago

Yes I mean, saving when working in the Text View.
In #4344 you wrote:

when you explicitly change something in the text view and switch back to Diagram/Icon view then we clear the stack

I do not switch back and forth - I just save the model. Internally it might me the same reason but still, it is a different issue.

As I said, the new behavior is really bothersome when I just work in the Text View. I often press [control]+[s] automatically from time to time. And then you can't go back :(
Currently, due to that, OMEdit is not really usable for me and I always have to keep an external copy of my previous work...

Can't you disable the stack of QPlainTextEdit with setUndoRedoEnabled(false) and implement a coherent stack for both graphical and textual changes?

Further, this might be helpful:
http://www.qtcentre.org/threads/43268-Setting-Text-in-QPlainTextEdit-without-Clearing-Undo-Redo-History

And this (reimplement the slots):

class MyTestEdit : public QPlainTextEdit {
    Q_OBJECT

public slots:
    void redo() { ... }
    void undo() { ... }

};

http://stackoverflow.com/questions/40346373/how-to-override-undo-redo-in-qplaintextedit

Last edited 8 years ago by Jan Kokert (previous) (diff)

comment:3 by Jan Kokert, 8 years ago

Summary: OMEdit: Undo stack is cleared when the model is savedOMEdit: Undo stack is cleared when the model is saved in TextView

in reply to:  2 comment:4 by Adeel Asghar, 8 years ago

Replying to janK:

Yes I mean, saving when working in the Text View.
In #4344 you wrote:

when you explicitly change something in the text view and switch back to Diagram/Icon view then we clear the stack

I do not switch back and forth - I just save the model. Internally it might me the same reason but still, it is a different issue.

Yes, it is same.

As I said, the new behavior is really bothersome when I just work in the Text View. I often press [control]+[s] automatically from time to time. And then you can't go back :(
Currently, due to that, OMEdit is not really usable for me and I always have to keep an external copy of my previous work...

Can't you disable the stack of QPlainTextEdit with setUndoRedoEnabled(false) and implement a coherent stack for both graphical and textual changes?

No. Then I need to keep track of text changes manually which literally means writing your own QPlainTextEdit.

Further, this might be helpful:
http://www.qtcentre.org/threads/43268-Setting-Text-in-QPlainTextEdit-without-Clearing-Undo-Redo-History

And this (reimplement the slots):

class MyTestEdit : public QPlainTextEdit {
    Q_OBJECT

public slots:
    void redo() { ... }
    void undo() { ... }

};

http://stackoverflow.com/questions/40346373/how-to-override-undo-redo-in-qplaintextedit

Yeah I have already seen all of these things and they don't really help.

I guess f681e38/OMEdit will fix this ticket but #4344 still remains.

comment:5 by Jan Kokert, 8 years ago

Reviewing all your commits and reverts it looks like it is actually a very difficult matter... I wish you the best of success to fix it soon :)

comment:6 by Adeel Asghar, 8 years ago

Milestone: Future1.12.0
Resolution: fixed
Status: newclosed

Yes, it is not easy.
I am closing this ticket since now text view stack is always retained.
The only remaining thing is to keep the diagram stack which is discussed in #4344.

comment:7 by Jan Kokert, 8 years ago

I confirm that this issue is fixed - Thanks a lot! Now we can work again thith the Nightly Builds :D

Version 0, edited 8 years ago by Jan Kokert (next)
Note: See TracTickets for help on using tickets.