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

#include <KoShapeKeepAspectRatioCommand.h>

+ Inheritance diagram for KoShapeKeepAspectRatioCommand:

Public Member Functions

 KoShapeKeepAspectRatioCommand (const QList< KoShape * > &shapes, bool newKeepAspectRatio, KUndo2Command *parent=0)
 
void redo () override
 Execute the command.
 
void undo () override
 Unexecute the command.
 
 ~KoShapeKeepAspectRatioCommand () 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

QList< bool > m_newKeepAspectRatio
 
QList< bool > m_oldKeepAspectRatio
 
QList< KoShape * > m_shapes
 

Detailed Description

Command that changes the keepAspectRatio property of KoShape

Definition at line 19 of file KoShapeKeepAspectRatioCommand.h.

Constructor & Destructor Documentation

◆ KoShapeKeepAspectRatioCommand()

KoShapeKeepAspectRatioCommand::KoShapeKeepAspectRatioCommand ( const QList< KoShape * > & shapes,
bool newKeepAspectRatio,
KUndo2Command * parent = 0 )

Constructor

Parameters
shapesthe shapes affected by the command
newKeepAspectRatiothe new setting
parentthe parent command

Definition at line 13 of file KoShapeKeepAspectRatioCommand.cpp.

14 : KUndo2Command(kundo2_i18n("Keep Aspect Ratio"), parent)
15 , m_shapes(shapes)
16{
17 Q_FOREACH (KoShape *shape, shapes) {
19 m_newKeepAspectRatio << newKeepAspectRatio;
20 }
21}
KUndo2Command(KUndo2Command *parent=0)
bool keepAspectRatio() const
Definition KoShape.cpp:870
KUndo2MagicString kundo2_i18n(const char *text)

References KoShape::keepAspectRatio(), m_newKeepAspectRatio, and m_oldKeepAspectRatio.

◆ ~KoShapeKeepAspectRatioCommand()

KoShapeKeepAspectRatioCommand::~KoShapeKeepAspectRatioCommand ( )
override

Definition at line 23 of file KoShapeKeepAspectRatioCommand.cpp.

24{
25}

Member Function Documentation

◆ redo()

void KoShapeKeepAspectRatioCommand::redo ( )
overridevirtual

Execute the command.

Reimplemented from KUndo2Command.

Definition at line 27 of file KoShapeKeepAspectRatioCommand.cpp.

28{
30 for (int i = 0; i < m_shapes.count(); ++i) {
31 m_shapes[i]->setKeepAspectRatio(m_newKeepAspectRatio[i]);
32 }
33}
virtual void redo()

References m_newKeepAspectRatio, m_shapes, and KUndo2Command::redo().

◆ undo()

void KoShapeKeepAspectRatioCommand::undo ( )
overridevirtual

Unexecute the command.

Reimplemented from KUndo2Command.

Definition at line 35 of file KoShapeKeepAspectRatioCommand.cpp.

36{
38 for (int i = 0; i < m_shapes.count(); ++i) {
39 m_shapes[i]->setKeepAspectRatio(m_oldKeepAspectRatio[i]);
40 }
41}
virtual void undo()

References m_oldKeepAspectRatio, m_shapes, and KUndo2Command::undo().

Member Data Documentation

◆ m_newKeepAspectRatio

QList<bool> KoShapeKeepAspectRatioCommand::m_newKeepAspectRatio
private

Definition at line 39 of file KoShapeKeepAspectRatioCommand.h.

◆ m_oldKeepAspectRatio

QList<bool> KoShapeKeepAspectRatioCommand::m_oldKeepAspectRatio
private

Definition at line 38 of file KoShapeKeepAspectRatioCommand.h.

◆ m_shapes

QList<KoShape*> KoShapeKeepAspectRatioCommand::m_shapes
private

Definition at line 37 of file KoShapeKeepAspectRatioCommand.h.


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