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

Public Member Functions

 AddGroupCommand (KoColorSet *colorSet, QString groupName, int columnCount, int rowCount)
 
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 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

KoColorSetm_colorSet
 
int m_columnCount
 
QString m_groupName
 
int m_rowCount
 

Detailed Description

Definition at line 273 of file KoColorSet.cpp.

Constructor & Destructor Documentation

◆ AddGroupCommand()

AddGroupCommand::AddGroupCommand ( KoColorSet * colorSet,
QString groupName,
int columnCount,
int rowCount )
inline

Definition at line 276 of file KoColorSet.cpp.

277 : m_colorSet(colorSet)
278 , m_groupName(groupName)
279 , m_columnCount(columnCount)
280 , m_rowCount(rowCount)
281 {
282 }
KoColorSet * m_colorSet

Member Function Documentation

◆ redo()

void AddGroupCommand::redo ( )
inlineoverridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 285 of file KoColorSet.cpp.

286 {
288 group->setName(m_groupName);
289 group->setColumnCount(m_columnCount);
290 group->setRowCount(m_rowCount);
292 m_colorSet->d->swatchGroups.append(group);
293 Q_EMIT m_colorSet->layoutChanged();
294 }
The KisSwatchGroup class stores a matrix of color swatches swatches can accessed using (x,...
void layoutChanged()
const QScopedPointer< Private > d
Definition KoColorSet.h:287
void layoutAboutToChange()

References KoColorSet::d, KoColorSet::layoutAboutToChange(), KoColorSet::layoutChanged(), m_colorSet, m_columnCount, m_groupName, and m_rowCount.

◆ undo()

void AddGroupCommand::undo ( )
inlineoverridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 298 of file KoColorSet.cpp.

299 {
300 int idx = 0;
301 bool found = false;
302 for(const KisSwatchGroupSP &group : m_colorSet->d->swatchGroups) {
303 if (group->name() == m_groupName) {
304 found = true;
305 break;
306 }
307 idx++;
308 }
309 if (found) {
311 m_colorSet->d->swatchGroups.takeAt(idx);
312 Q_EMIT m_colorSet->layoutChanged();
313 }
314 }
KUndo2CommandPrivate * d
Definition kundo2stack.h:88

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

Member Data Documentation

◆ m_colorSet

KoColorSet* AddGroupCommand::m_colorSet
private

Definition at line 317 of file KoColorSet.cpp.

◆ m_columnCount

int AddGroupCommand::m_columnCount
private

Definition at line 319 of file KoColorSet.cpp.

◆ m_groupName

QString AddGroupCommand::m_groupName
private

Definition at line 318 of file KoColorSet.cpp.

◆ m_rowCount

int AddGroupCommand::m_rowCount
private

Definition at line 320 of file KoColorSet.cpp.


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