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

Public Member Functions

 AddSwatchCommand (KoColorSet *colorSet, const KisSwatch &swatch, const QString &groupName, int column, int row)
 
void redo () override
 redo the command
 
void undo () override
 revert the actions done in redo
 
 ~AddSwatchCommand () 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

KoColorSetm_colorSet
 
QString m_groupName
 
KisSwatch m_swatch
 
int m_x
 
int m_y
 

Detailed Description

Definition at line 105 of file KoColorSet.cpp.

Constructor & Destructor Documentation

◆ AddSwatchCommand()

AddSwatchCommand::AddSwatchCommand ( KoColorSet * colorSet,
const KisSwatch & swatch,
const QString & groupName,
int column,
int row )
inline

Definition at line 108 of file KoColorSet.cpp.

109 : m_colorSet(colorSet)
110 , m_swatch(swatch)
111 , m_groupName(groupName)
112 , m_x(column)
113 , m_y(row)
114 {
115 }
KoColorSet * m_colorSet

◆ ~AddSwatchCommand()

AddSwatchCommand::~AddSwatchCommand ( )
inlineoverride

Definition at line 117 of file KoColorSet.cpp.

117{}

Member Function Documentation

◆ redo()

void AddSwatchCommand::redo ( )
inlineoverridevirtual

redo the command

Reimplemented from KUndo2Command.

Definition at line 120 of file KoColorSet.cpp.

121 {
123 if (m_x < 0 || m_y < 0) {
124 QPair<int, int> pos = modifiedGroup->addSwatch(m_swatch);
125 m_x = pos.first;
126 m_y = pos.second;
127 }
128 else {
129 modifiedGroup->setSwatch(m_swatch, m_x, m_y);
130 }
132 }
KisSwatchGroupSP getGroup(const QString &name) const
getGroup
void notifySwatchChanged(const QString &groupName, int column, int row)

References KoColorSet::getGroup(), m_colorSet, m_groupName, m_swatch, m_x, m_y, and KoColorSet::notifySwatchChanged().

◆ undo()

void AddSwatchCommand::undo ( )
inlineoverridevirtual

revert the actions done in redo

Reimplemented from KUndo2Command.

Definition at line 135 of file KoColorSet.cpp.

136 {
138 modifiedGroup->removeSwatch(m_x, m_y);
140 }

References KoColorSet::getGroup(), m_colorSet, m_groupName, m_x, m_y, and KoColorSet::notifySwatchChanged().

Member Data Documentation

◆ m_colorSet

KoColorSet* AddSwatchCommand::m_colorSet
private

Definition at line 143 of file KoColorSet.cpp.

◆ m_groupName

QString AddSwatchCommand::m_groupName
private

Definition at line 145 of file KoColorSet.cpp.

◆ m_swatch

KisSwatch AddSwatchCommand::m_swatch
private

Definition at line 144 of file KoColorSet.cpp.

◆ m_x

int AddSwatchCommand::m_x
private

Definition at line 146 of file KoColorSet.cpp.

◆ m_y

int AddSwatchCommand::m_y
private

Definition at line 147 of file KoColorSet.cpp.


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