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

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

#include <KoShapeShearCommand.h>

+ Inheritance diagram for KoShapeShearCommand:

Public Member Functions

 KoShapeShearCommand (const QList< KoShape * > &shapes, const QList< qreal > &previousShearXs, const QList< qreal > &previousShearYs, const QList< qreal > &newShearXs, const QList< qreal > &newShearYs, KUndo2Command *parent=0)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~KoShapeShearCommand () override
 
- 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 ()
 

Private Attributes

KoShapeShearCommandPrivate *const d
 

Detailed Description

The undo / redo command for shape shearing.

Definition at line 20 of file KoShapeShearCommand.h.

Constructor & Destructor Documentation

◆ KoShapeShearCommand()

KoShapeShearCommand::KoShapeShearCommand ( const QList< KoShape * > & shapes,
const QList< qreal > & previousShearXs,
const QList< qreal > & previousShearYs,
const QList< qreal > & newShearXs,
const QList< qreal > & newShearYs,
KUndo2Command * parent = 0 )

Command to rotate a selection of shapes. Note that it just alters the rotated property of those shapes, and nothing more.

Parameters
shapesall the shapes that should be rotated
previousShearXsa list with the same amount of items as shapes with the old shearX values
previousShearYsa list with the same amount of items as shapes with the old shearY values
newShearXsa list with the same amount of items as shapes with the new values.
newShearYsa list with the same amount of items as shapes with the new values.
parentthe parent command used for macro commands

Definition at line 23 of file KoShapeShearCommand.cpp.

24 : KUndo2Command(parent),
26{
27 d->shapes = shapes;
28 d->previousShearXs = previousShearXs;
29 d->previousShearYs = previousShearYs;
30 d->newShearXs = newShearXs;
31 d->newShearYs = newShearYs;
32
33 Q_ASSERT(d->shapes.count() == d->previousShearXs.count());
34 Q_ASSERT(d->shapes.count() == d->previousShearYs.count());
35 Q_ASSERT(d->shapes.count() == d->newShearXs.count());
36 Q_ASSERT(d->shapes.count() == d->newShearYs.count());
37
38 setText(kundo2_i18n("Shear shapes"));
39}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
KoShapeShearCommandPrivate *const d
KUndo2MagicString kundo2_i18n(const char *text)

References d, kundo2_i18n(), KoShapeShearCommandPrivate::newShearXs, KoShapeShearCommandPrivate::newShearYs, KoShapeShearCommandPrivate::previousShearXs, KoShapeShearCommandPrivate::previousShearYs, KUndo2Command::setText(), and KoShapeShearCommandPrivate::shapes.

◆ ~KoShapeShearCommand()

KoShapeShearCommand::~KoShapeShearCommand ( )
override

Definition at line 41 of file KoShapeShearCommand.cpp.

42{
43 delete d;
44}

References d.

Member Function Documentation

◆ redo()

void KoShapeShearCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 46 of file KoShapeShearCommand.cpp.

47{
49 for (int i = 0; i < d->shapes.count(); i++) {
50 d->shapes.at(i)->update();
51 d->shapes.at(i)->shear(d->newShearXs.at(i), d->newShearYs.at(i));
52 d->shapes.at(i)->update();
53 }
54}
virtual void redo()

References d, KoShapeShearCommandPrivate::newShearXs, KoShapeShearCommandPrivate::newShearYs, KUndo2Command::redo(), and KoShapeShearCommandPrivate::shapes.

◆ undo()

void KoShapeShearCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 56 of file KoShapeShearCommand.cpp.

57{
59 for (int i = 0; i < d->shapes.count(); i++) {
60 d->shapes.at(i)->update();
61 d->shapes.at(i)->shear(d->previousShearXs.at(i), d->previousShearYs.at(i));
62 d->shapes.at(i)->update();
63 }
64}
virtual void undo()

References d, KoShapeShearCommandPrivate::previousShearXs, KoShapeShearCommandPrivate::previousShearYs, KoShapeShearCommandPrivate::shapes, and KUndo2Command::undo().

Member Data Documentation

◆ d

KoShapeShearCommandPrivate* const KoShapeShearCommand::d
private

Definition at line 44 of file KoShapeShearCommand.h.


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