Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathReverseCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007 Jan Hambrecht <jaham@gmx.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
8#include "KoPathShape.h"
9#include <klocalizedstring.h>
10
11class Q_DECL_HIDDEN KoPathReverseCommand::Private
12{
13public:
15 : paths(p) {
16 }
18 }
19
20 void reverse() {
21 if (! paths.size())
22 return;
23
24 Q_FOREACH (KoPathShape* shape, paths) {
25 int subpathCount = shape->subpathCount();
26 for (int i = 0; i < subpathCount; ++i)
27 shape->reverseSubpath(i);
28 }
29 }
30
32};
33
35 : KUndo2Command(parent),
36 d(new Private(paths))
37{
38 setText(kundo2_i18n("Reverse paths"));
39}
40
45
47{
49
50 d->reverse();
51}
52
54{
56
57 d->reverse();
58}
const Params2D p
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
The undo / redo command for reversing path directions.
void redo() override
redo the command
QList< KoPathShape * > paths
Private(const QList< KoPathShape * > &p)
KoPathReverseCommand(const QList< KoPathShape * > &paths, KUndo2Command *parent=0)
void undo() override
revert the actions done in redo
The position of a path point within a path shape.
Definition KoPathShape.h:63
bool reverseSubpath(int subpathIndex)
Reverse subpath.
int subpathCount() const
Returns the number of subpaths in the path.
KUndo2MagicString kundo2_i18n(const char *text)