Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathFillRuleCommand Class Reference

The undo / redo command for setting the fill rule of a path shape. More...

#include <KoPathFillRuleCommand.h>

+ Inheritance diagram for KoPathFillRuleCommand:

Public Member Functions

 KoPathFillRuleCommand (const QList< KoPathShape * > &shapes, Qt::FillRule fillRule, KUndo2Command *parent=0)
 
 Private (Qt::FillRule fillRule)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~KoPathFillRuleCommand () override
 
- Public Member Functions inherited from KUndo2Command
QString actionText () const
 
virtual bool canAnnihilateWith (const KUndo2Command *other) const
 
const KUndo2Commandchild (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraDataextraData () const
 
bool hasParent () const
 
virtual int id () const
 
virtual bool isMerged () const
 
 KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 KUndo2Command (KUndo2Command *parent=0)
 
virtual QVector< KUndo2Command * > mergeCommandsVector () const
 
virtual bool mergeWith (const KUndo2Command *other)
 
virtual void redoMergedCommands ()
 
void setEndTime ()
 
virtual void setEndTime (const QTime &time)
 
void setExtraData (KUndo2CommandExtraData *data)
 
void setText (const KUndo2MagicString &text)
 
void setTime ()
 
virtual void setTime (const QTime &time)
 
virtual void setTimedID (int timedID)
 
KUndo2MagicString text () const
 
virtual QTime time () const
 
virtual int timedId () const
 
virtual bool timedMergeWith (KUndo2Command *other)
 
virtual void undoMergedCommands ()
 
virtual ~KUndo2Command ()
 

Public Attributes

Qt::FillRule newFillRule
 the new fill rule to set
 
QList< Qt::FillRule > oldFillRules
 the old fill rules, one for each shape
 
QList< KoPathShape * > shapes
 the shapes to set fill rule for
 

Private Attributes

Private *const d
 
- Private Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Additional Inherited Members

- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Detailed Description

The undo / redo command for setting the fill rule of a path shape.

Definition at line 12 of file KoPathFillRuleCommand.cpp.

Constructor & Destructor Documentation

◆ KoPathFillRuleCommand()

KoPathFillRuleCommand::KoPathFillRuleCommand ( const QList< KoPathShape * > & shapes,
Qt::FillRule fillRule,
KUndo2Command * parent = 0 )

Command to set a new shape background.

Parameters
shapesa set of all the path shapes that should get the new fill rule
fillRulethe new fill rule
parentthe parent command used for macro commands

Definition at line 23 of file KoPathFillRuleCommand.cpp.

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}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
QList< Qt::FillRule > oldFillRules
the old fill rules, one for each shape
QList< KoPathShape * > shapes
the shapes to set fill rule for
The position of a path point within a path shape.
Definition KoPathShape.h:63
KUndo2MagicString kundo2_i18n(const char *text)

References d, KoPathShape::fillRule(), kundo2_i18n(), KUndo2Command::setText(), and shapes.

◆ ~KoPathFillRuleCommand()

KoPathFillRuleCommand::~KoPathFillRuleCommand ( )
override

Definition at line 34 of file KoPathFillRuleCommand.cpp.

35{
36 delete d;
37}

References d.

Member Function Documentation

◆ Private()

KoPathFillRuleCommand::Private ( Qt::FillRule fillRule)
inline

Definition at line 15 of file KoPathFillRuleCommand.cpp.

15 : newFillRule(fillRule) {
16 }
Qt::FillRule newFillRule
the new fill rule to set

◆ redo()

void KoPathFillRuleCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 39 of file KoPathFillRuleCommand.cpp.

40{
42 Q_FOREACH (KoPathShape *shape, d->shapes) {
43 shape->setFillRule(d->newFillRule);
44 shape->update();
45 }
46}
virtual void redo()
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule to be used for painting the background.
void update() const override
reimplemented

References d, KUndo2Command::redo(), KoPathShape::setFillRule(), and KoShapeContainer::update().

◆ undo()

void KoPathFillRuleCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 48 of file KoPathFillRuleCommand.cpp.

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()

References d, KoPathShape::setFillRule(), KUndo2Command::undo(), and KoShapeContainer::update().

Member Data Documentation

◆ d

Private* const KoPathFillRuleCommand::d
private

Definition at line 35 of file KoPathFillRuleCommand.h.

◆ newFillRule

Qt::FillRule KoPathFillRuleCommand::newFillRule

the new fill rule to set

Definition at line 20 of file KoPathFillRuleCommand.cpp.

◆ oldFillRules

QList<Qt::FillRule> KoPathFillRuleCommand::oldFillRules

the old fill rules, one for each shape

Definition at line 19 of file KoPathFillRuleCommand.cpp.

◆ shapes

QList<KoPathShape*> KoPathFillRuleCommand::shapes

the shapes to set fill rule for

Definition at line 18 of file KoPathFillRuleCommand.cpp.


The documentation for this class was generated from the following files: