Krita Source Code Documentation
Loading...
Searching...
No Matches
KisChangeValueCommand< mem_ptr, ValueType > Struct Template Reference

#include <KisChangeValueCommand.h>

+ Inheritance diagram for KisChangeValueCommand< mem_ptr, ValueType >:

Public Member Functions

 KisChangeValueCommand (Base *base, const ValueType &newValue, KUndo2Command *parent=nullptr)
 
void redo ()
 
void undo ()
 
- 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 ()
 

Protected Attributes

Base * m_base
 
ValueType m_newValue
 
ValueType m_oldValue
 

Detailed Description

template<typename Base, typename Member, Member Base::* mem_ptr, typename ValueType>
struct KisChangeValueCommand< mem_ptr, ValueType >

Definition at line 28 of file KisChangeValueCommand.h.

Constructor & Destructor Documentation

◆ KisChangeValueCommand()

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
KisChangeValueCommand< mem_ptr, ValueType >::KisChangeValueCommand ( Base * base,
const ValueType & newValue,
KUndo2Command * parent = nullptr )
inline

Definition at line 30 of file KisChangeValueCommand.h.

Member Function Documentation

◆ redo()

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
void KisChangeValueCommand< mem_ptr, ValueType >::redo ( )
inlinevirtual

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 38 of file KisChangeValueCommand.h.

38 {
40 m_base->*mem_ptr = m_newValue;
41 }
virtual void redo()

References KUndo2Command::redo().

◆ undo()

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
void KisChangeValueCommand< mem_ptr, ValueType >::undo ( )
inlinevirtual

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 43 of file KisChangeValueCommand.h.

43 {
44 m_base->*mem_ptr = m_oldValue;
46 }
virtual void undo()

References KUndo2Command::undo().

Member Data Documentation

◆ m_base

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
Base* KisChangeValueCommand< mem_ptr, ValueType >::m_base
protected

Definition at line 49 of file KisChangeValueCommand.h.

◆ m_newValue

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
ValueType KisChangeValueCommand< mem_ptr, ValueType >::m_newValue
protected

Definition at line 51 of file KisChangeValueCommand.h.

◆ m_oldValue

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
ValueType KisChangeValueCommand< mem_ptr, ValueType >::m_oldValue
protected

Definition at line 50 of file KisChangeValueCommand.h.


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