aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/modelinglib/qmt/controller/undocommand.h
blob: ee1e63c4d1d9d08468e35efe1415c51d53456e03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2016 Jochen Becher
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QUndoCommand>
#include "qmt/infrastructure/qmt_global.h"

namespace qmt {

class QMT_EXPORT UndoCommand : public QUndoCommand
{
public:
    explicit UndoCommand(const QString &text);
    ~UndoCommand() override;

    bool canRedo() const { return m_canRedo; }
    int id() const override;
    void setDoNotMerge(bool doNotMerge);

    bool mergeWith(const QUndoCommand *other) override;
    virtual bool mergeWith(const UndoCommand *other);

    void undo() override;
    void redo() override;

private:
    bool m_canRedo = false;
    bool m_doNotMerge = false;
};

} // namespace qmt