Krita Source Code Documentation
Loading...
Searching...
No Matches
MultinodePropertyUndoCommand< PropertyAdapter > Class Template Reference

#include <kis_multinode_property.h>

+ Inheritance diagram for MultinodePropertyUndoCommand< PropertyAdapter >:

Public Types

typedef PropertyAdapter::ValueType ValueType
 

Public Member Functions

 MultinodePropertyUndoCommand (PropertyAdapter propAdapter, KisNodeList nodes, const QList< ValueType > &oldValues, ValueType newValue, KUndo2Command *parent=0)
 
void redo () override
 
void undo () 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

ValueType m_newValue
 
KisNodeList m_nodes
 
QList< ValueTypem_oldValues
 
PropertyAdapter m_propAdapter
 

Detailed Description

template<class PropertyAdapter>
class MultinodePropertyUndoCommand< PropertyAdapter >

Definition at line 410 of file kis_multinode_property.h.

Member Typedef Documentation

◆ ValueType

template<class PropertyAdapter >
typedef PropertyAdapter::ValueType MultinodePropertyUndoCommand< PropertyAdapter >::ValueType

Definition at line 413 of file kis_multinode_property.h.

Constructor & Destructor Documentation

◆ MultinodePropertyUndoCommand()

template<class PropertyAdapter >
MultinodePropertyUndoCommand< PropertyAdapter >::MultinodePropertyUndoCommand ( PropertyAdapter propAdapter,
KisNodeList nodes,
const QList< ValueType > & oldValues,
ValueType newValue,
KUndo2Command * parent = 0 )
inline

Definition at line 415 of file kis_multinode_property.h.

420 : KUndo2Command(parent),
421 m_propAdapter(propAdapter),
422 m_nodes(nodes),
423 m_oldValues(oldValues),
424 m_newValue(newValue)
425 {
426 }
KUndo2Command(KUndo2Command *parent=0)

Member Function Documentation

◆ redo()

template<class PropertyAdapter >
void MultinodePropertyUndoCommand< PropertyAdapter >::redo ( )
inlineoverridevirtual

Applies a change to the document. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls redo() on all child commands.

See also
undo()

Reimplemented from KUndo2Command.

Definition at line 436 of file kis_multinode_property.h.

436 {
437 int index = 0;
438 Q_FOREACH (KisNodeSP node, m_nodes) {
439 m_propAdapter.setPropForNode(node, m_newValue, index);
440 index++;
441 }
442 }

References MultinodePropertyUndoCommand< PropertyAdapter >::m_newValue, MultinodePropertyUndoCommand< PropertyAdapter >::m_nodes, and MultinodePropertyUndoCommand< PropertyAdapter >::m_propAdapter.

◆ undo()

template<class PropertyAdapter >
void MultinodePropertyUndoCommand< PropertyAdapter >::undo ( )
inlineoverridevirtual

Reverts a change to the document. After undo() is called, the state of the document should be the same as before redo() was called. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls undo() on all child commands in reverse order.

See also
redo()

Reimplemented from KUndo2Command.

Definition at line 428 of file kis_multinode_property.h.

428 {
429 int index = 0;
430 Q_FOREACH (KisNodeSP node, m_nodes) {
431 m_propAdapter.setPropForNode(node, m_oldValues[index], -1);
432 index++;
433 }
434 }

References MultinodePropertyUndoCommand< PropertyAdapter >::m_nodes, MultinodePropertyUndoCommand< PropertyAdapter >::m_oldValues, and MultinodePropertyUndoCommand< PropertyAdapter >::m_propAdapter.

Member Data Documentation

◆ m_newValue

template<class PropertyAdapter >
ValueType MultinodePropertyUndoCommand< PropertyAdapter >::m_newValue
private

Definition at line 448 of file kis_multinode_property.h.

◆ m_nodes

template<class PropertyAdapter >
KisNodeList MultinodePropertyUndoCommand< PropertyAdapter >::m_nodes
private

Definition at line 446 of file kis_multinode_property.h.

◆ m_oldValues

template<class PropertyAdapter >
QList<ValueType> MultinodePropertyUndoCommand< PropertyAdapter >::m_oldValues
private

Definition at line 447 of file kis_multinode_property.h.

◆ m_propAdapter

template<class PropertyAdapter >
PropertyAdapter MultinodePropertyUndoCommand< PropertyAdapter >::m_propAdapter
private

Definition at line 445 of file kis_multinode_property.h.


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