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

The undo / redo command for removing a subpath. More...

#include <KoSubpathRemoveCommand.h>

+ Inheritance diagram for KoSubpathRemoveCommand:

Public Member Functions

 KoSubpathRemoveCommand (KoPathShape *pathShape, int subpathIndex, KUndo2Command *parent=0)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~KoSubpathRemoveCommand () 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

KoPathShape * m_pathShape
 
KoSubpath * m_subpath
 
int m_subpathIndex
 

Detailed Description

The undo / redo command for removing a subpath.

Definition at line 16 of file KoSubpathRemoveCommand.h.

Constructor & Destructor Documentation

◆ KoSubpathRemoveCommand()

KoSubpathRemoveCommand::KoSubpathRemoveCommand ( KoPathShape * pathShape,
int subpathIndex,
KUndo2Command * parent = 0 )

Create a new command to remove a subpath.

Parameters
pathShapethe shape to work on.
subpathIndexthe index. See KoPathShape::removeSubpath()
parentthe parent command if the resulting command is a compound undo command.

Definition at line 15 of file KoSubpathRemoveCommand.cpp.

16 : KUndo2Command(parent)
17 , m_pathShape(pathShape)
18 , m_subpathIndex(subpathIndex)
19 , m_subpath(0)
20{
21 setText(kundo2_i18n("Remove subpath"));
22}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
KUndo2MagicString kundo2_i18n(const char *text)

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

◆ ~KoSubpathRemoveCommand()

KoSubpathRemoveCommand::~KoSubpathRemoveCommand ( )
override

Definition at line 24 of file KoSubpathRemoveCommand.cpp.

25{
26 if (m_subpath) {
27 qDeleteAll(*m_subpath);
28 delete m_subpath;
29 }
30}

References m_subpath.

Member Function Documentation

◆ redo()

void KoSubpathRemoveCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 32 of file KoSubpathRemoveCommand.cpp.

33{
37 if (m_subpath) {
38 QPointF offset = m_pathShape->normalize();
39
40 QTransform matrix;
41 matrix.translate(-offset.x(), -offset.y());
42 Q_FOREACH (KoPathPoint *point, *m_subpath) {
43 point->map(matrix);
44 }
46 }
47}
virtual void redo()
A KoPathPoint represents a point in a path.
void map(const QTransform &matrix)
apply matrix on the point
KoSubpath * removeSubpath(int subpathIndex)
Removes subpath from the path.
virtual QPointF normalize()
Normalizes the path data.
virtual void update() const
Definition KoShape.cpp:529

References m_pathShape, m_subpath, m_subpathIndex, KoPathPoint::map(), KoPathShape::normalize(), KUndo2Command::redo(), KoPathShape::removeSubpath(), and KoShape::update().

◆ undo()

void KoSubpathRemoveCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 49 of file KoSubpathRemoveCommand.cpp.

50{
52 if (m_subpath) {
56 m_subpath = 0;
57 }
58}
virtual void undo()
bool addSubpath(KoSubpath *subpath, int subpathIndex)
Adds a subpath at the given index to the path.

References KoPathShape::addSubpath(), m_pathShape, m_subpath, m_subpathIndex, KoPathShape::normalize(), KUndo2Command::undo(), and KoShape::update().

Member Data Documentation

◆ m_pathShape

KoPathShape* KoSubpathRemoveCommand::m_pathShape
private

Definition at line 34 of file KoSubpathRemoveCommand.h.

◆ m_subpath

KoSubpath* KoSubpathRemoveCommand::m_subpath
private

Definition at line 36 of file KoSubpathRemoveCommand.h.

◆ m_subpathIndex

int KoSubpathRemoveCommand::m_subpathIndex
private

Definition at line 35 of file KoSubpathRemoveCommand.h.


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