Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathFillRuleCommand.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
10#include <klocalizedstring.h>
11
12class Q_DECL_HIDDEN KoPathFillRuleCommand::Private
13{
14public:
15 Private(Qt::FillRule fillRule) : newFillRule(fillRule) {
16 }
17
20 Qt::FillRule newFillRule;
21};
22
24 : KUndo2Command(parent)
25 , d(new Private(fillRule))
26{
27 d->shapes = shapes;
28 Q_FOREACH (KoPathShape *shape, d->shapes)
29 d->oldFillRules.append(shape->fillRule());
30
31 setText(kundo2_i18n("Set fill rule"));
32}
33
38
40{
42 Q_FOREACH (KoPathShape *shape, d->shapes) {
43 shape->setFillRule(d->newFillRule);
44 shape->update();
45 }
46}
47
49{
51 QList<Qt::FillRule>::iterator ruleIt = d->oldFillRules.begin();
52 Q_FOREACH (KoPathShape *shape, d->shapes) {
53 shape->setFillRule(*ruleIt);
54 shape->update();
55 ++ruleIt;
56 }
57}
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
The undo / redo command for setting the fill rule of a path shape.
KoPathFillRuleCommand(const QList< KoPathShape * > &shapes, Qt::FillRule fillRule, KUndo2Command *parent=0)
QList< Qt::FillRule > oldFillRules
the old fill rules, one for each shape
void redo() override
redo the command
void undo() override
revert the actions done in redo
Private(Qt::FillRule fillRule)
Qt::FillRule newFillRule
the new fill rule to set
QList< KoPathShape * > shapes
the shapes to set fill rule for
The position of a path point within a path shape.
Definition KoPathShape.h:63
Qt::FillRule fillRule() const
Returns the fill rule for the path object.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule to be used for painting the background.
void update() const override
reimplemented
KUndo2MagicString kundo2_i18n(const char *text)