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

Public Member Functions

void redo () override
 redo the command
 
 RemoveGroupCommand (KoColorSet *colorSet, QString groupName, bool keepColors=true)
 
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
 
int m_groupIndex
 
QString m_groupName
 
bool m_keepColors
 
KisSwatchGroupSP m_oldGroup
 
int m_startingRow
 

Detailed Description

Definition at line 323 of file KoColorSet.cpp.

Constructor & Destructor Documentation

◆ RemoveGroupCommand()

RemoveGroupCommand::RemoveGroupCommand ( KoColorSet * colorSet,
QString groupName,
bool keepColors = true )
inline

Definition at line 325 of file KoColorSet.cpp.

326 : m_colorSet(colorSet)
327 , m_groupName(groupName)
328 , m_keepColors(keepColors)
329 , m_oldGroup(m_colorSet->getGroup(groupName))
330 , m_startingRow(m_colorSet->getGlobalGroup()->rowCount())
331 {
332 for (m_groupIndex = 0; m_groupIndex < colorSet->d->swatchGroups.size(); ++ m_groupIndex) {
333 if (colorSet->d->swatchGroups[m_groupIndex]->name() == m_oldGroup->name()) {
334 break;
335 }
336 }
337 }
KisSwatchGroupSP getGlobalGroup() const
getGlobalGroup
const QScopedPointer< Private > d
Definition KoColorSet.h:287
KisSwatchGroupSP getGroup(const QString &name) const
getGroup
KoColorSet * m_colorSet
KisSwatchGroupSP m_oldGroup

References KoColorSet::d, m_groupIndex, and m_oldGroup.

Member Function Documentation

◆ redo()

void RemoveGroupCommand::redo ( )
inlineoverridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 340 of file KoColorSet.cpp.

341 {
342 if (m_keepColors) {
343 // put all colors directly below global
345 for (const KisSwatchGroup::SwatchInfo &info : m_oldGroup->infoList()) {
346 globalGroup->setSwatch(info.swatch,
347 info.column,
348 info.row + m_startingRow);
349 }
350 }
351
353 m_colorSet->d->swatchGroups.removeOne(m_oldGroup);
354 Q_EMIT m_colorSet->layoutChanged();
355 }
void layoutChanged()
void layoutAboutToChange()

References KoColorSet::d, KoColorSet::getGlobalGroup(), KoColorSet::layoutAboutToChange(), KoColorSet::layoutChanged(), m_colorSet, m_keepColors, m_oldGroup, and m_startingRow.

◆ undo()

void RemoveGroupCommand::undo ( )
inlineoverridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 358 of file KoColorSet.cpp.

359 {
361 m_colorSet->d->swatchGroups.insert(m_groupIndex, m_oldGroup);
362
363 // remove all colors that were inserted into global
364 if (m_keepColors) {
366 for (const KisSwatchGroup::SwatchInfo &info : globalGroup->infoList()) {
367 m_oldGroup->setSwatch(info.swatch, info.column, info.row - m_startingRow);
368 globalGroup->removeSwatch(info.column,
369 info.row + m_startingRow);
370 }
371 }
372 Q_EMIT m_colorSet->layoutChanged();
373 }

References KoColorSet::d, KoColorSet::getGlobalGroup(), KoColorSet::layoutAboutToChange(), KoColorSet::layoutChanged(), m_colorSet, m_groupIndex, m_keepColors, m_oldGroup, and m_startingRow.

Member Data Documentation

◆ m_colorSet

KoColorSet* RemoveGroupCommand::m_colorSet
private

Definition at line 376 of file KoColorSet.cpp.

◆ m_groupIndex

int RemoveGroupCommand::m_groupIndex
private

Definition at line 380 of file KoColorSet.cpp.

◆ m_groupName

QString RemoveGroupCommand::m_groupName
private

Definition at line 377 of file KoColorSet.cpp.

◆ m_keepColors

bool RemoveGroupCommand::m_keepColors
private

Definition at line 378 of file KoColorSet.cpp.

◆ m_oldGroup

KisSwatchGroupSP RemoveGroupCommand::m_oldGroup
private

Definition at line 379 of file KoColorSet.cpp.

◆ m_startingRow

int RemoveGroupCommand::m_startingRow
private

Definition at line 381 of file KoColorSet.cpp.


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