QUndoView::QListView how to disable some item?
-
Hi,
There's no easy way to do that as QUndoView uses a custom model on top of QUndoStack/QUndoGroup.
Can you explain your use case ?
-
When the user works with the document, some operations may take a long time and in this case, these operation run in separate threads (for avoiding main GUI thread freeze).
Also, these operations apply to some object (for example layer) which is also can be added/remove by the user.
So Undo stack looks the following:<some command>
<add layer 0>
<draw on layer 0>
<draw on layer 0> <-- for example user select this command and then run processing (which is run in separate threads).
<remove layer 0>If during the processing user select command <remove layer 0> (or command before <add layer 0>) it may lead to an application crash, because "layer 0" is no longer exist.
This is why I need to disable (make unselectable) some commands (<add layer 0> and commands above & <remove layer 0> and commands bellow) from the stack when the operation is performed.
I can easily do that with actions but unfortunately, I do not find this possibility in QUndoView. -
And I don't think you are going to be able to do that with QUndoView as it is currently implemented.
You should check its implementation and create your own View/Model combo that fits your need. This is going to be faster.