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

The undo / redo command for changing a KoParameterShape into a KoPathShape. More...

#include <KoParameterToPathCommand.h>

+ Inheritance diagram for KoParameterToPathCommand:

Public Member Functions

 KoParameterToPathCommand (const QList< KoParameterShape * > &shapes, KUndo2Command *parent=0)
 
 KoParameterToPathCommand (KoParameterShape *shape, KUndo2Command *parent=0)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~KoParameterToPathCommand () override
 
- Public Member Functions inherited from KUndo2Command
QString actionText () const
 
virtual bool canAnnihilateWith (const KUndo2Command *other) const
 
const KUndo2Command * child (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraData * extraData () 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 ()
 

Private Attributes

KoParameterToPathCommandPrivate *const d
 

Detailed Description

The undo / redo command for changing a KoParameterShape into a KoPathShape.

Definition at line 20 of file KoParameterToPathCommand.h.

Constructor & Destructor Documentation

◆ KoParameterToPathCommand() [1/2]

KoParameterToPathCommand::KoParameterToPathCommand ( KoParameterShape * shape,
KUndo2Command * parent = 0 )
explicit

Constructor.

Parameters
shapethe shape this command works on
parentthe parent command if this is a compound undo command.

Definition at line 25 of file KoParameterToPathCommand.cpp.

26 : KUndo2Command(parent),
28{
29 d->shapes.append(shape);
30 d->initialize();
31 setText(kundo2_i18n("Convert to Path"));
32}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
KoParameterToPathCommandPrivate *const d
KUndo2MagicString kundo2_i18n(const char *text)

References d, KoParameterToPathCommandPrivate::initialize(), kundo2_i18n(), KUndo2Command::setText(), and KoParameterToPathCommandPrivate::shapes.

◆ KoParameterToPathCommand() [2/2]

KoParameterToPathCommand::KoParameterToPathCommand ( const QList< KoParameterShape * > & shapes,
KUndo2Command * parent = 0 )
explicit

Constructor.

Parameters
shapesthe list of shapes this command works on
parentthe parent command if this is a compound undo command.

Definition at line 34 of file KoParameterToPathCommand.cpp.

35 : KUndo2Command(parent),
37{
38 d->shapes = shapes;
39 d->initialize();
40 setText(kundo2_i18n("Convert to Path"));
41}

References d, KoParameterToPathCommandPrivate::initialize(), kundo2_i18n(), KUndo2Command::setText(), and KoParameterToPathCommandPrivate::shapes.

◆ ~KoParameterToPathCommand()

KoParameterToPathCommand::~KoParameterToPathCommand ( )
override

Definition at line 43 of file KoParameterToPathCommand.cpp.

44{
45 delete d;
46}

References d.

Member Function Documentation

◆ redo()

void KoParameterToPathCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 48 of file KoParameterToPathCommand.cpp.

49{
51 for (int i = 0; i < d->shapes.size(); ++i) {
52 KoParameterShape *parameterShape = d->shapes.at(i);
53 parameterShape->update();
54 parameterShape->setParametricShape(false);
55 parameterShape->update();
56 }
57}
virtual void redo()
void setParametricShape(bool parametric)
Set if the shape can be modified using parameters.
virtual void update() const
Definition KoShape.cpp:529

References d, KUndo2Command::redo(), KoParameterShape::setParametricShape(), KoParameterToPathCommandPrivate::shapes, and KoShape::update().

◆ undo()

void KoParameterToPathCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 59 of file KoParameterToPathCommand.cpp.

60{
62 for (int i = 0; i < d->shapes.size(); ++i) {
63 KoParameterShape * parameterShape = d->shapes.at(i);
64 parameterShape->update();
65 parameterShape->setParametricShape(true);
66 d->copyPath(parameterShape, d->copies[i]);
67 parameterShape->update();
68 }
69}
virtual void undo()
void copyPath(KoPathShape *destination, KoPathShape *source)

References KoParameterToPathCommandPrivate::copies, KoParameterToPathCommandPrivate::copyPath(), d, KoParameterShape::setParametricShape(), KoParameterToPathCommandPrivate::shapes, KUndo2Command::undo(), and KoShape::update().

Member Data Documentation

◆ d

KoParameterToPathCommandPrivate* const KoParameterToPathCommand::d
private

Definition at line 42 of file KoParameterToPathCommand.h.


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