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

#include <KisChangeValueCommand.h>

+ Inheritance diagram for KisChangeIndirectValueCommand< mem_ptr, ValueType >:

Public Member Functions

 KisChangeIndirectValueCommand (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 ()
 

Private Attributes

Base * m_base
 
ValueType m_newValue
 
ValueType m_oldValue
 

Detailed Description

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

Definition at line 76 of file KisChangeValueCommand.h.

Constructor & Destructor Documentation

◆ KisChangeIndirectValueCommand()

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

Member Function Documentation

◆ redo()

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
void KisChangeIndirectValueCommand< 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 86 of file KisChangeValueCommand.h.

86 {
88 *(m_base->*mem_ptr) = m_newValue;
89 }
virtual void redo()

References KUndo2Command::redo().

◆ undo()

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
void KisChangeIndirectValueCommand< 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 91 of file KisChangeValueCommand.h.

91 {
92 *(m_base->*mem_ptr) = m_oldValue;
94 }
virtual void undo()

References KUndo2Command::undo().

Member Data Documentation

◆ m_base

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
Base* KisChangeIndirectValueCommand< mem_ptr, ValueType >::m_base
private

Definition at line 96 of file KisChangeValueCommand.h.

◆ m_newValue

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
ValueType KisChangeIndirectValueCommand< mem_ptr, ValueType >::m_newValue
private

Definition at line 98 of file KisChangeValueCommand.h.

◆ m_oldValue

template<typename Base , typename Member , Member Base::* mem_ptr, typename ValueType >
ValueType KisChangeIndirectValueCommand< mem_ptr, ValueType >::m_oldValue
private

Definition at line 97 of file KisChangeValueCommand.h.


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