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

The undo / redo command to lock a set of shapes position and size. More...

#include <KoShapeLockCommand.h>

+ Inheritance diagram for KoShapeLockCommand:

Public Member Functions

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

QList< bool > m_newLock
 old lock states
 
QList< bool > m_oldLock
 the shapes to set background for
 
QList< KoShape * > m_shapes
 

Detailed Description

The undo / redo command to lock a set of shapes position and size.

Definition at line 17 of file KoShapeLockCommand.h.

Constructor & Destructor Documentation

◆ KoShapeLockCommand()

KoShapeLockCommand::KoShapeLockCommand ( const QList< KoShape * > & shapes,
const QList< bool > & oldLock,
const QList< bool > & newLock,
KUndo2Command * parent = 0 )

Command to lock a set of shapes position and size

Parameters
shapesa set of shapes that should change lock state
oldLocklist of old lock states the same length as shapes
newLocklist of new lock states the same length as shapes
parentthe parent command used for macro commands

Definition at line 13 of file KoShapeLockCommand.cpp.

14 : KUndo2Command(parent)
15 , m_shapes(shapes)
16 , m_oldLock(oldLock)
17 , m_newLock(newLock)
18{
19 Q_ASSERT(m_shapes.count() == m_oldLock.count());
20 Q_ASSERT(m_shapes.count() == m_newLock.count());
21
22 setText(kundo2_i18n("Lock shapes"));
23}
void setText(const KUndo2MagicString &text)
KUndo2Command(KUndo2Command *parent=0)
QList< KoShape * > m_shapes
QList< bool > m_newLock
old lock states
QList< bool > m_oldLock
the shapes to set background for
KUndo2MagicString kundo2_i18n(const char *text)

References kundo2_i18n(), m_newLock, m_oldLock, m_shapes, and KUndo2Command::setText().

◆ ~KoShapeLockCommand()

KoShapeLockCommand::~KoShapeLockCommand ( )
override

Definition at line 25 of file KoShapeLockCommand.cpp.

26{
27}

Member Function Documentation

◆ redo()

void KoShapeLockCommand::redo ( )
overridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 29 of file KoShapeLockCommand.cpp.

30{
32 for (int i = 0; i < m_shapes.count(); ++i) {
33 m_shapes[i]->setGeometryProtected(m_newLock[i]);
34 }
35}
virtual void redo()

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

◆ undo()

void KoShapeLockCommand::undo ( )
overridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 37 of file KoShapeLockCommand.cpp.

38{
40 for (int i = 0; i < m_shapes.count(); ++i) {
41 m_shapes[i]->setGeometryProtected(m_oldLock[i]);
42 }
43}
virtual void undo()

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

Member Data Documentation

◆ m_newLock

QList<bool> KoShapeLockCommand::m_newLock
private

old lock states

Definition at line 39 of file KoShapeLockCommand.h.

◆ m_oldLock

QList<bool> KoShapeLockCommand::m_oldLock
private

the shapes to set background for

Definition at line 38 of file KoShapeLockCommand.h.

◆ m_shapes

QList<KoShape*> KoShapeLockCommand::m_shapes
private

Definition at line 37 of file KoShapeLockCommand.h.


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