work towards making timeline actions all undoable
This commit is contained in:
+10
-1
@@ -1,3 +1,12 @@
|
||||
#include "undostack.h"
|
||||
|
||||
QUndoStack olive::undo_stack;
|
||||
OliveUndoStack olive::undo_stack;
|
||||
|
||||
void OliveUndoStack::pushIfHasChildren(QUndoCommand *command)
|
||||
{
|
||||
if (command->childCount() > 0) {
|
||||
push(command);
|
||||
} else {
|
||||
delete command;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -3,11 +3,21 @@
|
||||
|
||||
#include <QUndoStack>
|
||||
|
||||
class OliveUndoStack : public QUndoStack {
|
||||
public:
|
||||
/**
|
||||
* @brief A wrapper for push() that either pushes if the command has children or deletes if not
|
||||
*
|
||||
* This function takes ownership of `command`, and may delete it so it should never be accessed after this call.
|
||||
*/
|
||||
void pushIfHasChildren(QUndoCommand* command);
|
||||
};
|
||||
|
||||
namespace olive {
|
||||
/**
|
||||
* @brief A static undo stack for undoable commands throughout Olive
|
||||
*/
|
||||
extern QUndoStack undo_stack;
|
||||
extern OliveUndoStack undo_stack;
|
||||
}
|
||||
|
||||
#endif // UNDOSTACK_H
|
||||
|
||||
Reference in New Issue
Block a user