QElectroTech  0.70
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ModifyTitleBlockCellCommand Class Reference

#include <templatecommands.h>

Public Member Functions

 ModifyTitleBlockCellCommand (TitleBlockCell *, QUndoCommand *=nullptr)
 
 ~ModifyTitleBlockCellCommand () override
 
int id () const override
 
bool mergeWith (const QUndoCommand *) override
 
void undo () override
 
void redo () override
 
TitleBlockCellcell () const
 
void setCell (TitleBlockCell *)
 
TitleBlockTemplateViewview () const
 
void setView (TitleBlockTemplateView *)
 
void clear ()
 
void addModification (const QString &, const QVariant &, bool=false)
 

Private Member Functions

 ModifyTitleBlockCellCommand (const ModifyTitleBlockCellCommand &)
 

Private Attributes

TitleBlockTemplateViewview_
 This class may trigger a view update. More...
 
TitleBlockCellmodified_cell_
 modified cell More...
 
QHash< QString, QVariant > old_values_
 values before the cell is modified More...
 
QHash< QString, QVariant > new_values_
 values after the cell has been modified More...
 

Detailed Description

This class represents a set of modification applied to a title block template cell.

Definition at line 33 of file templatecommands.h.

Constructor & Destructor Documentation

◆ ModifyTitleBlockCellCommand() [1/2]

ModifyTitleBlockCellCommand::ModifyTitleBlockCellCommand ( TitleBlockCell cell,
QUndoCommand *  parent = nullptr 
)

Constructor

Parameters
cellModified cell
parentParent QUndoCommand

Definition at line 31 of file templatecommands.cpp.

◆ ~ModifyTitleBlockCellCommand()

ModifyTitleBlockCellCommand::~ModifyTitleBlockCellCommand ( )
override

Destructor

Definition at line 41 of file templatecommands.cpp.

◆ ModifyTitleBlockCellCommand() [2/2]

ModifyTitleBlockCellCommand::ModifyTitleBlockCellCommand ( const ModifyTitleBlockCellCommand )
private

Member Function Documentation

◆ addModification()

void ModifyTitleBlockCellCommand::addModification ( const QString &  attribute,
const QVariant &  value,
bool  is_old_value = false 
)

Register a new modification on a title block template cell; you may indicate either the new value or the old one: this method will systematically fetch the other one.

Parameters
attributeName of the modified attribute
valueOld or new value of the modified attribute, depending on is_old_value
is_old_value(optional, defaults to false) Indicates whether the provided value is the old or the new one.

Definition at line 138 of file templatecommands.cpp.

References modified_cell_, new_values_, and old_values_.

◆ cell()

TitleBlockCell * ModifyTitleBlockCellCommand::cell ( ) const
Returns
the cell modified by this command

Definition at line 95 of file templatecommands.cpp.

References modified_cell_.

◆ clear()

void ModifyTitleBlockCellCommand::clear ( )

Erase the known old/new values.

Definition at line 125 of file templatecommands.cpp.

References new_values_, and old_values_.

◆ id()

int ModifyTitleBlockCellCommand::id ( ) const
override
See also
QUndoCommand::id()
Returns
the ID of this command.

Definition at line 48 of file templatecommands.cpp.

References MODIFY_TITLE_BLOCK_CELL_COMMAND_ID.

◆ mergeWith()

bool ModifyTitleBlockCellCommand::mergeWith ( const QUndoCommand *  command)
override
See also
QUndoCommand::mergeWith()
Parameters
commandCommand to merge with.
Returns
true on success, false otherwise

Definition at line 57 of file templatecommands.cpp.

References modified_cell_, and new_values_.

◆ redo()

void ModifyTitleBlockCellCommand::redo ( )
override

Redo the change.

Definition at line 84 of file templatecommands.cpp.

References modified_cell_, new_values_, and view_.

◆ setCell()

void ModifyTitleBlockCellCommand::setCell ( TitleBlockCell modified_cell)

Set the cell modified by this command object

Parameters
modified_cellthe cell modified by this command

Definition at line 103 of file templatecommands.cpp.

References modified_cell_.

◆ setView()

void ModifyTitleBlockCellCommand::setView ( TitleBlockTemplateView view)

Set the view to be updated after the cell modification

Parameters
viewthe view to be updated after the cell modification

Definition at line 118 of file templatecommands.cpp.

References view(), and view_.

◆ undo()

void ModifyTitleBlockCellCommand::undo ( )
override

Undo the change.

Definition at line 73 of file templatecommands.cpp.

References modified_cell_, old_values_, and view_.

◆ view()

TitleBlockTemplateView * ModifyTitleBlockCellCommand::view ( ) const
Returns
the view to be updated after the cell modification

Definition at line 110 of file templatecommands.cpp.

References view_.

Referenced by setView().

Member Data Documentation

◆ modified_cell_

TitleBlockCell* ModifyTitleBlockCellCommand::modified_cell_
private

modified cell

Definition at line 57 of file templatecommands.h.

Referenced by addModification(), cell(), mergeWith(), redo(), setCell(), and undo().

◆ new_values_

QHash<QString, QVariant> ModifyTitleBlockCellCommand::new_values_
private

values after the cell has been modified

Definition at line 59 of file templatecommands.h.

Referenced by addModification(), clear(), mergeWith(), and redo().

◆ old_values_

QHash<QString, QVariant> ModifyTitleBlockCellCommand::old_values_
private

values before the cell is modified

Definition at line 58 of file templatecommands.h.

Referenced by addModification(), clear(), and undo().

◆ view_

TitleBlockTemplateView* ModifyTitleBlockCellCommand::view_
private

This class may trigger a view update.

Definition at line 56 of file templatecommands.h.

Referenced by redo(), setView(), undo(), and view().


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