Krita Source Code Documentation
Loading...
Searching...
No Matches
MoveGroupCommand Struct Reference
+ Inheritance diagram for MoveGroupCommand:

Public Member Functions

 MoveGroupCommand (KoColorSet *colorSet, QString groupName, const QString &groupNameInsertBefore)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
- 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

KoColorSet * m_colorSet
 
QString m_groupName
 
QString m_groupNameInsertBefore
 
int m_newIndex
 
int m_oldIndex
 

Detailed Description

Definition at line 219 of file KoColorSet.cpp.

Constructor & Destructor Documentation

◆ MoveGroupCommand()

MoveGroupCommand::MoveGroupCommand ( KoColorSet * colorSet,
QString groupName,
const QString & groupNameInsertBefore )
inline

Definition at line 222 of file KoColorSet.cpp.

223 : m_colorSet(colorSet)
224 , m_groupName(groupName)
225 , m_groupNameInsertBefore(groupNameInsertBefore)
226 {
227 int idx = 0;
228 for (const KisSwatchGroupSP &group : m_colorSet->d->swatchGroups) {
229
230 if (group->name() == m_groupName) {
231 m_oldIndex = idx;
232 }
233
234 if (group->name() == m_groupNameInsertBefore) {
235 m_newIndex = idx;
236 }
237
238 idx++;
239 }
240 }
KUndo2CommandPrivate * d
Definition kundo2stack.h:88
QString m_groupNameInsertBefore
KoColorSet * m_colorSet

References KoColorSet::d, m_colorSet, m_groupName, m_groupNameInsertBefore, m_newIndex, and m_oldIndex.

Member Function Documentation

◆ redo()

void MoveGroupCommand::redo ( )
inlineoverridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 243 of file KoColorSet.cpp.

244 {
247 {
249 KisSwatchGroupSP group = m_colorSet->d->swatchGroups.takeAt(m_oldIndex);
250 m_colorSet->d->swatchGroups.insert(m_newIndex, group);
251 Q_EMIT m_colorSet->layoutChanged();
252 }
253 }
void layoutChanged()
const QScopedPointer< Private > d
Definition KoColorSet.h:287
static const QString GLOBAL_GROUP_NAME
Definition KoColorSet.h:33
void layoutAboutToChange()

References KoColorSet::d, KoColorSet::GLOBAL_GROUP_NAME, KoColorSet::layoutAboutToChange(), KoColorSet::layoutChanged(), m_colorSet, m_groupName, m_groupNameInsertBefore, m_newIndex, and m_oldIndex.

◆ undo()

void MoveGroupCommand::undo ( )
inlineoverridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 257 of file KoColorSet.cpp.

258 {
260 KisSwatchGroupSP group = m_colorSet->d->swatchGroups.takeAt(m_newIndex);
261 m_colorSet->d->swatchGroups.insert(m_oldIndex, group);
262 Q_EMIT m_colorSet->layoutChanged();
263 }

References KoColorSet::d, KoColorSet::layoutAboutToChange(), KoColorSet::layoutChanged(), m_colorSet, m_newIndex, and m_oldIndex.

Member Data Documentation

◆ m_colorSet

KoColorSet* MoveGroupCommand::m_colorSet
private

Definition at line 266 of file KoColorSet.cpp.

◆ m_groupName

QString MoveGroupCommand::m_groupName
private

Definition at line 267 of file KoColorSet.cpp.

◆ m_groupNameInsertBefore

QString MoveGroupCommand::m_groupNameInsertBefore
private

Definition at line 268 of file KoColorSet.cpp.

◆ m_newIndex

int MoveGroupCommand::m_newIndex
private

Definition at line 270 of file KoColorSet.cpp.

◆ m_oldIndex

int MoveGroupCommand::m_oldIndex
private

Definition at line 269 of file KoColorSet.cpp.


The documentation for this struct was generated from the following file: