Krita Source Code Documentation
Loading...
Searching...
No Matches
KisNodeRenameCommand.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include <klocalizedstring.h>
10#include "kis_node.h"
12#include "kis_command_ids.h"
13
14KisNodeRenameCommand::KisNodeRenameCommand(KisNodeSP node, const QString &oldName, const QString &newName)
15 : KisNodeCommand(kundo2_i18n("Node Rename"), node)
16{
17 m_oldName = oldName;
18 m_newName = newName;
19}
20
25
30
35
37{
38 const KisNodeRenameCommand *other =
39 dynamic_cast<const KisNodeRenameCommand*>(command);
40
41 if (other && other->m_node == m_node) {
43 m_newName = other->m_newName;
44 return true;
45 }
46
47 return false;
48}
49
51{
52 const KisNodeRenameCommand *other =
53 dynamic_cast<const KisNodeRenameCommand*>(command);
54
55 return other && other->m_node == m_node;
56}
the base command for commands altering a node
The command for setting the node's name.
int id() const override
KisNodeRenameCommand(KisNodeSP node, const QString &oldName, const QString &newName)
bool mergeWith(const KUndo2Command *command) override
bool canMergeWith(const KUndo2Command *command) const override
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
KUndo2MagicString kundo2_i18n(const char *text)
void setName(const QString &name)