Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDeselectActiveSelectionCommand Class Reference

#include <KisDeselectActiveSelectionCommand.h>

+ Inheritance diagram for KisDeselectActiveSelectionCommand:

Public Member Functions

 KisDeselectActiveSelectionCommand (KisSelectionSP activeSelection, KisImageWSP image, KUndo2Command *parent=0)
 
void redo () override
 
void undo () override
 
 ~KisDeselectActiveSelectionCommand () override
 
- Public Member Functions inherited from KisDeselectGlobalSelectionCommand
 KisDeselectGlobalSelectionCommand (KisImageWSP image, KUndo2Command *parent=0)
 
void populateChildCommands () override
 
 ~KisDeselectGlobalSelectionCommand () override
 
- Public Member Functions inherited from KisCommandUtils::AggregateCommand
 AggregateCommand (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 AggregateCommand (KUndo2Command *parent=0)
 
- 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

KisSelectionSP m_activeSelection
 
KisSelectionMaskSP m_deselectedMask
 

Additional Inherited Members

- Protected Member Functions inherited from KisCommandUtils::AggregateCommand
void addCommand (KUndo2Command *cmd)
 
- Protected Attributes inherited from KisDeselectGlobalSelectionCommand
KisImageWSP m_image
 

Detailed Description

Definition at line 12 of file KisDeselectActiveSelectionCommand.h.

Constructor & Destructor Documentation

◆ KisDeselectActiveSelectionCommand()

KisDeselectActiveSelectionCommand::KisDeselectActiveSelectionCommand ( KisSelectionSP activeSelection,
KisImageWSP image,
KUndo2Command * parent = 0 )

Definition at line 12 of file KisDeselectActiveSelectionCommand.cpp.

13 : KisDeselectGlobalSelectionCommand(image, parent),
14 m_activeSelection(activeSelection)
15{
16}
KisDeselectGlobalSelectionCommand(KisImageWSP image, KUndo2Command *parent=0)

◆ ~KisDeselectActiveSelectionCommand()

KisDeselectActiveSelectionCommand::~KisDeselectActiveSelectionCommand ( )
override

Definition at line 18 of file KisDeselectActiveSelectionCommand.cpp.

19{
20}

Member Function Documentation

◆ redo()

void KisDeselectActiveSelectionCommand::redo ( )
overridevirtual

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 KisCommandUtils::AggregateCommand.

Definition at line 22 of file KisDeselectActiveSelectionCommand.cpp.

23{
26
29 } else if (m_activeSelection) {
31 if (!parentNode) return;
32
33 m_deselectedMask = dynamic_cast<KisSelectionMask*>(parentNode.data());
34 if (m_deselectedMask) {
37 return;
38 }
39
41 }
42 }
43}
KisSelectionSP globalSelection() const
Definition kis_image.cc:695
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
void setActive(bool active)
KisNodeWSP parentNode

References KisSelectionMask::active(), KisSharedPtr< T >::clear(), KisSharedPtr< T >::data(), KisImage::globalSelection(), KIS_SAFE_ASSERT_RECOVER, KIS_SAFE_ASSERT_RECOVER_RETURN, m_activeSelection, m_deselectedMask, KisDeselectGlobalSelectionCommand::m_image, KisSelection::parentNode, KisCommandUtils::AggregateCommand::redo(), KisSelectionMask::setActive(), and KisWeakSharedPtr< T >::toStrongRef().

◆ undo()

void KisDeselectActiveSelectionCommand::undo ( )
overridevirtual

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 KisCommandUtils::AggregateCommand.

Definition at line 45 of file KisDeselectActiveSelectionCommand.cpp.

References KisSharedPtr< T >::clear(), m_deselectedMask, KisSelectionMask::setActive(), and KisCommandUtils::AggregateCommand::undo().

Member Data Documentation

◆ m_activeSelection

KisSelectionSP KisDeselectActiveSelectionCommand::m_activeSelection
private

Definition at line 22 of file KisDeselectActiveSelectionCommand.h.

◆ m_deselectedMask

KisSelectionMaskSP KisDeselectActiveSelectionCommand::m_deselectedMask
private

Definition at line 23 of file KisDeselectActiveSelectionCommand.h.


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