Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeSizeCommand.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
10#include <KoShape.h>
11#include <klocalizedstring.h>
12
13class Q_DECL_HIDDEN KoShapeSizeCommand::Private
14{
15public:
17 QList<QSizeF> previousSizes, newSizes;
18};
19
20KoShapeSizeCommand::KoShapeSizeCommand(const QList<KoShape*> &shapes, const QList<QSizeF> &previousSizes, const QList<QSizeF> &newSizes, KUndo2Command *parent)
21 : KUndo2Command(parent),
22 d(new Private())
23{
24 d->previousSizes = previousSizes;
25 d->newSizes = newSizes;
26 d->shapes = shapes;
27 Q_ASSERT(d->shapes.count() == d->previousSizes.count());
28 Q_ASSERT(d->shapes.count() == d->newSizes.count());
29
30 setText(kundo2_i18n("Resize shapes"));
31}
32
37
39{
41 int i = 0;
42 Q_FOREACH (KoShape *shape, d->shapes) {
43 shape->update();
44 shape->setSize(d->newSizes[i++]);
45 shape->update();
46 }
47}
48
50{
52 int i = 0;
53 Q_FOREACH (KoShape *shape, d->shapes) {
54 shape->update();
55 shape->setSize(d->previousSizes[i++]);
56 shape->update();
57 }
58}
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
The undo / redo command for shape sizing.
void undo() override
revert the actions done in redo
void redo() override
redo the command
KoShapeSizeCommand(const QList< KoShape * > &shapes, const QList< QSizeF > &previousSizes, const QList< QSizeF > &newSizes, KUndo2Command *parent=0)
QList< KoShape * > shapes
QList< QSizeF > previousSizes
virtual void update() const
Definition KoShape.cpp:605
virtual void setSize(const QSizeF &size)
Resize the shape.
Definition KoShape.cpp:276
KUndo2MagicString kundo2_i18n(const char *text)