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

A command to add a connection between two shapes. More...

#include <KoShapeConnectionChangeCommand.h>

+ Inheritance diagram for KoShapeConnectionChangeCommand:

Public Member Functions

 KoShapeConnectionChangeCommand (KoConnectionShape *connection, KoConnectionShape::HandleId connectionHandle, KoShape *oldConnectedShape, int oldConnectionPointId, KoShape *newConnectedShape, int newConnectionPointId, KUndo2Command *parent=0)
 
 Private ()
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~KoShapeConnectionChangeCommand () override
 Destroys the command.
 
- 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

KoConnectionShape * connection
 
KoConnectionShape::HandleId connectionHandle
 
KoShapenewConnectedShape
 
int newConnectionPointId
 
KoShapeoldConnectedShape
 
int oldConnectionPointId
 

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

A command to add a connection between two shapes.

Definition at line 9 of file KoShapeConnectionChangeCommand.cpp.

Constructor & Destructor Documentation

◆ KoShapeConnectionChangeCommand()

KoShapeConnectionChangeCommand::KoShapeConnectionChangeCommand ( KoConnectionShape * connection,
KoConnectionShape::HandleId connectionHandle,
KoShape * oldConnectedShape,
int oldConnectionPointId,
KoShape * newConnectedShape,
int newConnectionPointId,
KUndo2Command * parent = 0 )

Creates command to connect a connection shape to a shape

Parameters
connectionthe connection shape to connect to the shape
connectionHandlethe handle of the connection to connect to
oldConnectedShapethe old shape we were connected to
newConnectedShapethe new shape to connect to
connectionPointIdthe id of the connection point to connect to
parentthe parent undo command

Definition at line 27 of file KoShapeConnectionChangeCommand.cpp.

31 : KUndo2Command(parent), d(new Private)
32{
33 d->connection = connection;
34 d->connectionHandle = connectionHandle;
35 d->oldConnectedShape = oldConnectedShape;
36 d->oldConnectionPointId = oldConnectionPointId;
37 d->newConnectedShape = newConnectedShape;
38 d->newConnectionPointId = newConnectionPointId;
39}
KUndo2Command(KUndo2Command *parent=0)

References connection, connectionHandle, d, newConnectedShape, newConnectionPointId, oldConnectedShape, and oldConnectionPointId.

◆ ~KoShapeConnectionChangeCommand()

KoShapeConnectionChangeCommand::~KoShapeConnectionChangeCommand ( )
override

Destroys the command.

Definition at line 41 of file KoShapeConnectionChangeCommand.cpp.

42{
43 delete d;
44}

References d.

Member Function Documentation

◆ Private()

KoShapeConnectionChangeCommand::Private ( )
inline

◆ redo()

void KoShapeConnectionChangeCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 46 of file KoShapeConnectionChangeCommand.cpp.

47{
48 if(d->connection) {
49 if(d->connectionHandle == KoConnectionShape::StartHandle) {
50 d->connection->connectFirst(d->newConnectedShape, d->newConnectionPointId);
51 }
52 else {
53 d->connection->connectSecond(d->newConnectedShape, d->newConnectionPointId);
54 }
55 }
56
58}
virtual void redo()

References d, and KUndo2Command::redo().

◆ undo()

void KoShapeConnectionChangeCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 60 of file KoShapeConnectionChangeCommand.cpp.

61{
63
64 if(d->connection) {
65 if(d->connectionHandle == KoConnectionShape::StartHandle) {
66 d->connection->connectFirst(d->oldConnectedShape, d->oldConnectionPointId);
67 }
68 else {
69 d->connection->connectSecond(d->oldConnectedShape, d->oldConnectionPointId);
70 }
71 }
72}
virtual void undo()

References d, and KUndo2Command::undo().

Member Data Documentation

◆ connection

KoConnectionShape* KoShapeConnectionChangeCommand::connection

Definition at line 18 of file KoShapeConnectionChangeCommand.cpp.

◆ connectionHandle

KoConnectionShape::HandleId KoShapeConnectionChangeCommand::connectionHandle

Definition at line 19 of file KoShapeConnectionChangeCommand.cpp.

◆ d

Private* const KoShapeConnectionChangeCommand::d
private

Definition at line 41 of file KoShapeConnectionChangeCommand.h.

◆ newConnectedShape

KoShape* KoShapeConnectionChangeCommand::newConnectedShape

Definition at line 20 of file KoShapeConnectionChangeCommand.cpp.

◆ newConnectionPointId

int KoShapeConnectionChangeCommand::newConnectionPointId

Definition at line 22 of file KoShapeConnectionChangeCommand.cpp.

◆ oldConnectedShape

KoShape* KoShapeConnectionChangeCommand::oldConnectedShape

Definition at line 21 of file KoShapeConnectionChangeCommand.cpp.

◆ oldConnectionPointId

int KoShapeConnectionChangeCommand::oldConnectionPointId

Definition at line 23 of file KoShapeConnectionChangeCommand.cpp.


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