File indexing completed on 2024-04-14 04:46:30

0001 /*
0002     SPDX-FileCopyrightText: 2017 Nicolas Carion
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #include "docundostack.hpp"
0007 #include <QUndoCommand>
0008 #include <QUndoGroup>
0009 
0010 DocUndoStack::DocUndoStack(QUndoGroup *parent)
0011     : QUndoStack(parent)
0012 {
0013 }
0014 
0015 // TODO: custom undostack everywhere do that
0016 void DocUndoStack::push(QUndoCommand *cmd)
0017 {
0018     if (index() < count()) {
0019         Q_EMIT invalidate(index());
0020     }
0021     QUndoStack::push(cmd);
0022 }