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

The undo / redo command for shape sizing. More...

#include <KoShapeSizeCommand.h>

+ Inheritance diagram for KoShapeSizeCommand:

Public Member Functions

 KoShapeSizeCommand (const QList< KoShape * > &shapes, const QList< QSizeF > &previousSizes, const QList< QSizeF > &newSizes, KUndo2Command *parent=0)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~KoShapeSizeCommand () 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 ()
 

Public Attributes

QList< QSizeF > newSizes
 
QList< QSizeF > previousSizes
 
QList< KoShape * > shapes
 

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 shape sizing.

Definition at line 13 of file KoShapeSizeCommand.cpp.

Constructor & Destructor Documentation

◆ KoShapeSizeCommand()

KoShapeSizeCommand::KoShapeSizeCommand ( const QList< KoShape * > & shapes,
const QList< QSizeF > & previousSizes,
const QList< QSizeF > & newSizes,
KUndo2Command * parent = 0 )

The undo / redo command for shape sizing.

Parameters
shapesall the shapes that will be resized at the same time
previousSizesthe old sizes; in a list with a member for each shape
newSizesthe new sizes; in a list with a member for each shape
parentthe parent command used for macro commands

Definition at line 20 of file KoShapeSizeCommand.cpp.

21 : KUndo2Command(parent),
22 d(new Private())
23{
24 d->previousSizes = previousSizes;
25 d->newSizes = newSizes;
26 d->shapes = shapes;
27 Q_ASSERT(d->shapes.count() == d->previousSizes.count());
28 Q_ASSERT(d->shapes.count() == d->newSizes.count());
29
30 setText(kundo2_i18n("Resize shapes"));
31}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
QList< KoShape * > shapes
QList< QSizeF > previousSizes
KUndo2MagicString kundo2_i18n(const char *text)

References d, kundo2_i18n(), newSizes, previousSizes, KUndo2Command::setText(), and shapes.

◆ ~KoShapeSizeCommand()

KoShapeSizeCommand::~KoShapeSizeCommand ( )
override

Definition at line 33 of file KoShapeSizeCommand.cpp.

34{
35 delete d;
36}

References d.

Member Function Documentation

◆ redo()

void KoShapeSizeCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 38 of file KoShapeSizeCommand.cpp.

39{
41 int i = 0;
42 Q_FOREACH (KoShape *shape, d->shapes) {
43 shape->update();
44 shape->setSize(d->newSizes[i++]);
45 shape->update();
46 }
47}
virtual void redo()
virtual void update() const
Definition KoShape.cpp:529
virtual void setSize(const QSizeF &size)
Resize the shape.
Definition KoShape.cpp:249

References d, KUndo2Command::redo(), KoShape::setSize(), and KoShape::update().

◆ undo()

void KoShapeSizeCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 49 of file KoShapeSizeCommand.cpp.

50{
52 int i = 0;
53 Q_FOREACH (KoShape *shape, d->shapes) {
54 shape->update();
55 shape->setSize(d->previousSizes[i++]);
56 shape->update();
57 }
58}
virtual void undo()

References d, KoShape::setSize(), KUndo2Command::undo(), and KoShape::update().

Member Data Documentation

◆ d

Private* const KoShapeSizeCommand::d
private

Definition at line 40 of file KoShapeSizeCommand.h.

◆ newSizes

QList<QSizeF> KoShapeSizeCommand::newSizes

Definition at line 17 of file KoShapeSizeCommand.cpp.

◆ previousSizes

QList<QSizeF> KoShapeSizeCommand::previousSizes

Definition at line 17 of file KoShapeSizeCommand.cpp.

◆ shapes

QList<KoShape*> KoShapeSizeCommand::shapes

Definition at line 16 of file KoShapeSizeCommand.cpp.


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