Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeKeepAspectRatioCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007 Peter Simonsson <peter.simonsson@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
8
9#include <klocalizedstring.h>
10
11#include <KoShape.h>
12
14 : KUndo2Command(kundo2_i18n("Keep Aspect Ratio"), parent)
15 , m_shapes(shapes)
16{
17 Q_FOREACH (KoShape *shape, shapes) {
19 m_newKeepAspectRatio << newKeepAspectRatio;
20 }
21}
22
26
28{
30 for (int i = 0; i < m_shapes.count(); ++i) {
31 m_shapes[i]->setKeepAspectRatio(m_newKeepAspectRatio[i]);
32 }
33}
34
36{
38 for (int i = 0; i < m_shapes.count(); ++i) {
39 m_shapes[i]->setKeepAspectRatio(m_oldKeepAspectRatio[i]);
40 }
41}
virtual void undo()
virtual void redo()
KoShapeKeepAspectRatioCommand(const QList< KoShape * > &shapes, bool newKeepAspectRatio, KUndo2Command *parent=0)
void undo() override
Unexecute the command.
void redo() override
Execute the command.
bool keepAspectRatio() const
Definition KoShape.cpp:1052
KUndo2MagicString kundo2_i18n(const char *text)