Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeLockCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org>
3 * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
9#include "KoShape.h"
10
11#include <klocalizedstring.h>
12
14 : KUndo2Command(parent)
15 , m_shapes(shapes)
16 , m_oldLock(oldLock)
17 , m_newLock(newLock)
18{
19 Q_ASSERT(m_shapes.count() == m_oldLock.count());
20 Q_ASSERT(m_shapes.count() == m_newLock.count());
21
22 setText(kundo2_i18n("Lock shapes"));
23}
24
28
30{
32 for (int i = 0; i < m_shapes.count(); ++i) {
33 m_shapes[i]->setGeometryProtected(m_newLock[i]);
34 }
35}
36
38{
40 for (int i = 0; i < m_shapes.count(); ++i) {
41 m_shapes[i]->setGeometryProtected(m_oldLock[i]);
42 }
43}
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
KoShapeLockCommand(const QList< KoShape * > &shapes, const QList< bool > &oldLock, const QList< bool > &newLock, KUndo2Command *parent=0)
void undo() override
revert the actions done in redo
QList< KoShape * > m_shapes
QList< bool > m_newLock
old lock states
QList< bool > m_oldLock
the shapes to set background for
void redo() override
redo the command
KUndo2MagicString kundo2_i18n(const char *text)