QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsComposerItemCommand Class Reference

Undo command to undo/redo all composer item related changes. More...

#include <qgscomposeritemcommand.h>

Inheritance diagram for QgsComposerItemCommand:
Inheritance graph
[legend]

Public Member Functions

 QgsComposerItemCommand (QgsComposerItem *item, const QString &text, QUndoCommand *parent=nullptr)
 
virtual ~QgsComposerItemCommand ()
 
QDomDocument afterState () const
 
bool containsChange () const
 Returns true if previous state and after state are valid and different. More...
 
QgsComposerItemitem () const
 Returns the target item the command applies to. More...
 
QDomDocument previousState () const
 
void redo () override
 Replays the command. More...
 
void saveAfterState ()
 Saves current item state as after state. More...
 
void savePreviousState ()
 Saves current item state as previous state. More...
 
void undo () override
 Reverses the command. More...
 
- Public Member Functions inherited from QUndoCommand
 QUndoCommand (QUndoCommand *parent)
 
 QUndoCommand (const QString &text, QUndoCommand *parent)
 
virtual ~QUndoCommand ()
 
QString actionText () const
 
const QUndoCommandchild (int index) const
 
int childCount () const
 
virtual int id () const
 
virtual bool mergeWith (const QUndoCommand *command)
 
void setText (const QString &text)
 
QString text () const
 

Protected Member Functions

void restoreState (QDomDocument &stateDoc) const
 
void saveState (QDomDocument &stateDoc) const
 

Protected Attributes

QDomDocument mAfterState
 XML containing the state after executing the command. More...
 
bool mFirstRun
 Flag to prevent the first redo() if the command is pushed to the undo stack. More...
 
int mFrameNumber
 
QgsComposerItemmItem
 Target item of the command. More...
 
QgsComposerMultiFramemMultiFrame
 Parameters for frame items. More...
 
QDomDocument mPreviousState
 XML that saves the state before executing the command. More...
 

Detailed Description

Undo command to undo/redo all composer item related changes.

Definition at line 30 of file qgscomposeritemcommand.h.

Constructor & Destructor Documentation

◆ QgsComposerItemCommand()

QgsComposerItemCommand::QgsComposerItemCommand ( QgsComposerItem item,
const QString text,
QUndoCommand parent = nullptr 
)

Definition at line 25 of file qgscomposeritemcommand.cpp.

◆ ~QgsComposerItemCommand()

QgsComposerItemCommand::~QgsComposerItemCommand ( )
virtual

Definition at line 42 of file qgscomposeritemcommand.cpp.

Member Function Documentation

◆ afterState()

QDomDocument QgsComposerItemCommand::afterState ( ) const
inline

Definition at line 47 of file qgscomposeritemcommand.h.

◆ containsChange()

bool QgsComposerItemCommand::containsChange ( ) const

Returns true if previous state and after state are valid and different.

Definition at line 61 of file qgscomposeritemcommand.cpp.

◆ item()

QgsComposerItem * QgsComposerItemCommand::item ( ) const

Returns the target item the command applies to.

Returns
target composer item

Definition at line 66 of file qgscomposeritemcommand.cpp.

◆ previousState()

QDomDocument QgsComposerItemCommand::previousState ( ) const
inline

Definition at line 46 of file qgscomposeritemcommand.h.

◆ redo()

void QgsComposerItemCommand::redo ( )
overridevirtual

Replays the command.

Reimplemented from QUndoCommand.

Definition at line 51 of file qgscomposeritemcommand.cpp.

◆ restoreState()

void QgsComposerItemCommand::restoreState ( QDomDocument stateDoc) const
protected

Definition at line 111 of file qgscomposeritemcommand.cpp.

◆ saveAfterState()

void QgsComposerItemCommand::saveAfterState ( )

Saves current item state as after state.

Definition at line 92 of file qgscomposeritemcommand.cpp.

◆ savePreviousState()

void QgsComposerItemCommand::savePreviousState ( )

Saves current item state as previous state.

Definition at line 87 of file qgscomposeritemcommand.cpp.

◆ saveState()

void QgsComposerItemCommand::saveState ( QDomDocument stateDoc) const
protected

Definition at line 97 of file qgscomposeritemcommand.cpp.

◆ undo()

void QgsComposerItemCommand::undo ( )
overridevirtual

Reverses the command.

Reimplemented from QUndoCommand.

Definition at line 46 of file qgscomposeritemcommand.cpp.

Member Data Documentation

◆ mAfterState

QDomDocument QgsComposerItemCommand::mAfterState
protected

XML containing the state after executing the command.

Definition at line 63 of file qgscomposeritemcommand.h.

◆ mFirstRun

bool QgsComposerItemCommand::mFirstRun
protected

Flag to prevent the first redo() if the command is pushed to the undo stack.

Definition at line 71 of file qgscomposeritemcommand.h.

◆ mFrameNumber

int QgsComposerItemCommand::mFrameNumber
protected

Definition at line 68 of file qgscomposeritemcommand.h.

◆ mItem

QgsComposerItem* QgsComposerItemCommand::mItem
protected

Target item of the command.

Definition at line 59 of file qgscomposeritemcommand.h.

◆ mMultiFrame

QgsComposerMultiFrame* QgsComposerItemCommand::mMultiFrame
protected

Parameters for frame items.

Parent multiframe

Definition at line 67 of file qgscomposeritemcommand.h.

◆ mPreviousState

QDomDocument QgsComposerItemCommand::mPreviousState
protected

XML that saves the state before executing the command.

Definition at line 61 of file qgscomposeritemcommand.h.


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