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

The undo / redo command for reversing path directions. More...

#include <KoPathReverseCommand.h>

+ Inheritance diagram for KoPathReverseCommand:

Public Member Functions

 KoPathReverseCommand (const QList< KoPathShape * > &paths, KUndo2Command *parent=0)
 
 Private (const QList< KoPathShape * > &p)
 
void redo () override
 redo the command
 
void reverse ()
 
void undo () override
 revert the actions done in redo
 
 ~KoPathReverseCommand () override
 
 ~Private ()
 
- 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 ()
 

Public Attributes

QList< KoPathShape * > paths
 

Private Attributes

Private *const d
 
- Private Attributes inherited from Private
KisCanvas2 * canvas
 
int displayedFrame
 
int intendedFrame
 

Additional Inherited Members

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

Detailed Description

The undo / redo command for reversing path directions.

Definition at line 11 of file KoPathReverseCommand.cpp.

Constructor & Destructor Documentation

◆ ~Private()

KoPathReverseCommand::~Private ( )
inline

Definition at line 17 of file KoPathReverseCommand.cpp.

17 {
18 }

◆ KoPathReverseCommand()

KoPathReverseCommand::KoPathReverseCommand ( const QList< KoPathShape * > & paths,
KUndo2Command * parent = 0 )
explicit

Command for reversing directions of a list of paths

Parameters
pathsthe list of paths to reverse
parentthe parent command used for macro commands

Definition at line 34 of file KoPathReverseCommand.cpp.

35 : KUndo2Command(parent),
36 d(new Private(paths))
37{
38 setText(kundo2_i18n("Reverse paths"));
39}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
QList< KoPathShape * > paths
KUndo2MagicString kundo2_i18n(const char *text)

References kundo2_i18n(), and KUndo2Command::setText().

◆ ~KoPathReverseCommand()

KoPathReverseCommand::~KoPathReverseCommand ( )
override

Definition at line 41 of file KoPathReverseCommand.cpp.

42{
43 delete d;
44}

References d.

Member Function Documentation

◆ Private()

KoPathReverseCommand::Private ( const QList< KoPathShape * > & p)
inline

Definition at line 14 of file KoPathReverseCommand.cpp.

15 : paths(p) {
16 }
const Params2D p

◆ redo()

void KoPathReverseCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 46 of file KoPathReverseCommand.cpp.

47{
49
50 d->reverse();
51}
virtual void redo()

References d, and KUndo2Command::redo().

◆ reverse()

void KoPathReverseCommand::reverse ( )
inline

Definition at line 20 of file KoPathReverseCommand.cpp.

20 {
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 }
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.

References KoPathShape::reverseSubpath(), and KoPathShape::subpathCount().

◆ undo()

void KoPathReverseCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 53 of file KoPathReverseCommand.cpp.

54{
56
57 d->reverse();
58}
virtual void undo()

References d, and KUndo2Command::undo().

Member Data Documentation

◆ d

Private* const KoPathReverseCommand::d
private

Definition at line 33 of file KoPathReverseCommand.h.

◆ paths

QList<KoPathShape*> KoPathReverseCommand::paths

Definition at line 31 of file KoPathReverseCommand.cpp.


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