Krita Source Code Documentation
Loading...
Searching...
No Matches
KoSubpathRemoveCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
3 * SPDX-FileCopyrightText: 2006, 2007 Thorsten Zachmann <zachmann@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
9
10#include "KoPathPointData.h"
11#include "KoPathPoint.h"
12#include "KoPathShape.h"
13#include <klocalizedstring.h>
14
16 : KUndo2Command(parent)
17 , m_pathShape(pathShape)
18 , m_subpathIndex(subpathIndex)
19 , m_subpath(0)
20{
21 setText(kundo2_i18n("Remove subpath"));
22}
23
25{
26 if (m_subpath) {
27 qDeleteAll(*m_subpath);
28 delete m_subpath;
29 }
30}
31
33{
37 if (m_subpath) {
38 QPointF offset = m_pathShape->normalize();
39
40 QTransform matrix;
41 matrix.translate(-offset.x(), -offset.y());
42 Q_FOREACH (KoPathPoint *point, *m_subpath) {
43 point->map(matrix);
44 }
46 }
47}
48
59
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
A KoPathPoint represents a point in a path.
void map(const QTransform &matrix)
apply matrix on the point
The position of a path point within a path shape.
Definition KoPathShape.h:63
KoSubpath * removeSubpath(int subpathIndex)
Removes subpath from the path.
virtual QPointF normalize()
Normalizes the path data.
bool addSubpath(KoSubpath *subpath, int subpathIndex)
Adds a subpath at the given index to the path.
void update() const override
reimplemented
void undo() override
revert the actions done in redo
KoSubpathRemoveCommand(KoPathShape *pathShape, int subpathIndex, KUndo2Command *parent=0)
void redo() override
redo the command
KUndo2MagicString kundo2_i18n(const char *text)