Ideas to custom bookmark feature
-
Hi,
My application already has a undo/redo feature where I push/pop some action into containers such as QUndoGroup and QUndoStack. The functionality works fine.
However, I need another bookmark like feature, where clicking one of the bookmark will trigger an action that is already been recorded. Many such bookmarks can exist for each tab. This can otherwise be termed as save/restore feature.Consider it as an advanced version of QUndoFramework, where the actions go last in first out (LIFO) while in my requirement, I can trigger any action from anywhere of the stack.
| A1 |
| A2 |
| A3 |
| A4 |
Here I can save A3 action in some container and clicking it will perform that action.
Can anyone pitch me some ideas on how to do it?
-
Hi,
My application already has a undo/redo feature where I push/pop some action into containers such as QUndoGroup and QUndoStack. The functionality works fine.
However, I need another bookmark like feature, where clicking one of the bookmark will trigger an action that is already been recorded. Many such bookmarks can exist for each tab. This can otherwise be termed as save/restore feature.Consider it as an advanced version of QUndoFramework, where the actions go last in first out (LIFO) while in my requirement, I can trigger any action from anywhere of the stack.
| A1 |
| A2 |
| A3 |
| A4 |
Here I can save A3 action in some container and clicking it will perform that action.
Can anyone pitch me some ideas on how to do it?
@vijaychsk
I can just say this: theQUndoStackexplicitly forbids (at least writable) access to anything in the stack other than the topmost, in a LIFO order. This obviously corresponds to an "undo-redo" functionality.const QUndoCommand *QUndoStack::command(int index) const
Returns a const pointer to the command at index.
This function returns a const pointer, because modifying a command, once it has been pushed onto the stack and executed, almost always causes corruption of the state of the document, if the command is later undone or redone.
Your requirement of picking up some previous action from anywhere and then executing it ("where clicking one of the bookmark will trigger an action that is already been recorded") does not correspond to anything in an "undo" sense. You can still use that method to access an old action and your own code to execute it from where you are now, but I don't see it related to undo/redoing.
-
@vijaychsk
I can just say this: theQUndoStackexplicitly forbids (at least writable) access to anything in the stack other than the topmost, in a LIFO order. This obviously corresponds to an "undo-redo" functionality.const QUndoCommand *QUndoStack::command(int index) const
Returns a const pointer to the command at index.
This function returns a const pointer, because modifying a command, once it has been pushed onto the stack and executed, almost always causes corruption of the state of the document, if the command is later undone or redone.
Your requirement of picking up some previous action from anywhere and then executing it ("where clicking one of the bookmark will trigger an action that is already been recorded") does not correspond to anything in an "undo" sense. You can still use that method to access an old action and your own code to execute it from where you are now, but I don't see it related to undo/redoing.
-
@vijaychsk
I can just say this: theQUndoStackexplicitly forbids (at least writable) access to anything in the stack other than the topmost, in a LIFO order. This obviously corresponds to an "undo-redo" functionality.const QUndoCommand *QUndoStack::command(int index) const
Returns a const pointer to the command at index.
This function returns a const pointer, because modifying a command, once it has been pushed onto the stack and executed, almost always causes corruption of the state of the document, if the command is later undone or redone.
Your requirement of picking up some previous action from anywhere and then executing it ("where clicking one of the bookmark will trigger an action that is already been recorded") does not correspond to anything in an "undo" sense. You can still use that method to access an old action and your own code to execute it from where you are now, but I don't see it related to undo/redoing.
@JonB said in Ideas to custom bookmark feature:
You can still use that method to access an old action and your own code to execute it from where you are now
?