PDA

View Full Version : shared QUnstackStack among several QMainWindows ?



umanga
11th November 2010, 03:44
Greetings all,

In my application,user can open several QWindows which share the same data.I needed to use one shared QUndoStack between the windows.

Undo/Redo works fine,but when any of a QWindow closed, Undo/Redo menu get disabled.I guess its because the stack get cleared.

Any tips? Thanks

Here is a snapshot of my application - http://oi53.tinypic.com/2rfbztg.jpg

tbscope
11th November 2010, 07:30
I guess you need to write something of your own.

How would the stack delete only those items that belong to one window?
And if it does know how to do that, what sense does this make? Doesn't this mean that the whole undo/redo history is corrupted anyway?

umanga
11th November 2010, 07:58
thanks tbscope for you answer,

Actually , I dont want to delete items that belongs to a particular window.
When undoing, it should do normal undo operation ,and it doesnt matter whether its same window or not.(Because my application uses MVC pattern,where I have one Data and multiple Views).
Only problem is when I close any of the QMainWindow , my QUndoStack also get cleared.
May be during onClose() method of QMainWindow, QT clears any QUndoStack attached to that.
If you can just override this method,then I think I can solve the problem.




I guess you need to write something of your own.

How would the stack delete only those items that belong to one window?
And if it does know how to do that, what sense does this make? Doesn't this mean that the whole undo/redo history is corrupted anyway?