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

#include <templatecommands.h>

Public Member Functions

 ModifyTemplateGridCommand (TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
 
 ~ModifyTemplateGridCommand () override
 
int index () const
 
void setIndex (int)
 
QList< TitleBlockCell * > cells () const
 
void setCells (const QList< TitleBlockCell *> &)
 
TitleBlockDimension dimension () const
 
void setDimension (const TitleBlockDimension &)
 
int type () const
 
void setType (bool)
 
bool isInsertion () const
 
void setInsertion (bool)
 
void undo () override
 
void redo () override
 
- Public Member Functions inherited from TitleBlockTemplateCommand
 TitleBlockTemplateCommand (TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
 
 ~TitleBlockTemplateCommand () override
 
TitleBlockTemplatetitleBlockTemplate () const
 
void setTitleBlockTemplate (TitleBlockTemplate *)
 
TitleBlockTemplateViewview () const
 
void setView (TitleBlockTemplateView *)
 
void refreshView ()
 
void refreshLayout ()
 

Static Public Member Functions

static ModifyTemplateGridCommandaddRow (TitleBlockTemplate *, int=-1)
 
static ModifyTemplateGridCommandaddColumn (TitleBlockTemplate *, int=-1)
 
static ModifyTemplateGridCommanddeleteRow (TitleBlockTemplate *, int=-1)
 
static ModifyTemplateGridCommanddeleteColumn (TitleBlockTemplate *, int=-1)
 

Private Member Functions

 ModifyTemplateGridCommand (const ModifyTemplateGridCommand &)
 
void updateText ()
 
void apply (bool=false)
 

Private Attributes

int index_
 Index of the inserted/deleted row/column. More...
 
QList< TitleBlockCell * > cells_
 Cells composing the inserted/deleted row/column. More...
 
bool type_
 true for a row, false for a column More...
 
TitleBlockDimension dimension_
 width/height of the column/row, which interpretation depends on type_ More...
 
bool insertion_
 

Additional Inherited Members

- Protected Attributes inherited from TitleBlockTemplateCommand
TitleBlockTemplatetbtemplate_
 Modified TitleBlock Template. More...
 
TitleBlockTemplateViewview_
 This class may trigger a view update. More...
 

Detailed Description

This class represents the action of adding or deleting a row or column within a title block template.

Definition at line 93 of file templatecommands.h.

Constructor & Destructor Documentation

◆ ModifyTemplateGridCommand() [1/2]

ModifyTemplateGridCommand::ModifyTemplateGridCommand ( TitleBlockTemplate tbtemplate = nullptr,
QUndoCommand *  parent = nullptr 
)

Construct a default ModifyTemplateGridCommand, i.e. a command adding a 25px row at the bottom of the template.

Parameters
tbtemplateModified title block template
parentParent QUndoCommand

Definition at line 303 of file templatecommands.cpp.

References updateText().

Referenced by addColumn(), addRow(), deleteColumn(), and deleteRow().

◆ ~ModifyTemplateGridCommand()

ModifyTemplateGridCommand::~ModifyTemplateGridCommand ( )
override

Destructor

Definition at line 316 of file templatecommands.cpp.

◆ ModifyTemplateGridCommand() [2/2]

ModifyTemplateGridCommand::ModifyTemplateGridCommand ( const ModifyTemplateGridCommand )
private

Member Function Documentation

◆ addColumn()

ModifyTemplateGridCommand * ModifyTemplateGridCommand::addColumn ( TitleBlockTemplate tbtemplate,
int  index = -1 
)
static

This static method is a convenience to create a ModifyTemplateGridCommand that adds a column to tbtemplate at index.

Parameters
tbtemplateModified title block template.
indexIndex where the column should be inserted.
Returns
a ModifyTemplateGridCommand object, or 0 if something went wrong.

Definition at line 246 of file templatecommands.cpp.

References index(), ModifyTemplateGridCommand(), setCells(), setDimension(), setIndex(), setInsertion(), setType(), and TITLEBLOCK_DEFAULT_COL_WIDTH.

Referenced by TitleBlockTemplateView::addColumnAfter(), TitleBlockTemplateView::addColumnAtEnd(), and TitleBlockTemplateView::addColumnBefore().

◆ addRow()

ModifyTemplateGridCommand * ModifyTemplateGridCommand::addRow ( TitleBlockTemplate tbtemplate,
int  index = -1 
)
static

This static method is a convenience to create a ModifyTemplateGridCommand that adds a row to tbtemplate at index.

Parameters
tbtemplateModified title block template
indexIndex where the row should be inserted.
Returns
a ModifyTemplateGridCommand object, or 0 if something went wrong.

Definition at line 225 of file templatecommands.cpp.

References index(), ModifyTemplateGridCommand(), setCells(), setDimension(), setIndex(), setInsertion(), setType(), and TITLEBLOCK_DEFAULT_ROW_HEIGHT.

Referenced by TitleBlockTemplateView::addRowAfter(), TitleBlockTemplateView::addRowAtEnd(), and TitleBlockTemplateView::addRowBefore().

◆ apply()

void ModifyTemplateGridCommand::apply ( bool  undo = false)
private

◆ cells()

QList< TitleBlockCell * > ModifyTemplateGridCommand::cells ( ) const
Returns
a list of pointers to cells composing the inserted/deleted row/column.

Definition at line 337 of file templatecommands.cpp.

References cells_.

Referenced by setCells().

◆ deleteColumn()

ModifyTemplateGridCommand * ModifyTemplateGridCommand::deleteColumn ( TitleBlockTemplate tbtemplate,
int  index = -1 
)
static

This static method is a convenience to create a ModifyTemplateGridCommand that removes the column at index from tbtemplate.

Parameters
tbtemplateModified title block template.
indexIndex of the removed column.
Returns
a ModifyTemplateGridCommand object, or 0 if something went wrong.

Definition at line 286 of file templatecommands.cpp.

References index(), ModifyTemplateGridCommand(), setIndex(), setInsertion(), and setType().

Referenced by TitleBlockTemplateView::deleteColumn().

◆ deleteRow()

ModifyTemplateGridCommand * ModifyTemplateGridCommand::deleteRow ( TitleBlockTemplate tbtemplate,
int  index = -1 
)
static

This static method is a convenience to create a ModifyTemplateGridCommand that removes the row at index from tbtemplate.

Parameters
tbtemplateModified title block template.
indexIndex of the removed row.
Returns
a ModifyTemplateGridCommand object, or 0 if something went wrong.

Definition at line 267 of file templatecommands.cpp.

References index(), ModifyTemplateGridCommand(), setIndex(), setInsertion(), and setType().

Referenced by TitleBlockTemplateView::deleteRow().

◆ dimension()

TitleBlockDimension ModifyTemplateGridCommand::dimension ( ) const
Returns
the dimension of the inserted/deleted row/column.

Definition at line 352 of file templatecommands.cpp.

References dimension_.

Referenced by setDimension().

◆ index()

int ModifyTemplateGridCommand::index ( ) const
Returns
the index of the inserted/deleted row/column

Definition at line 322 of file templatecommands.cpp.

References index_.

Referenced by addColumn(), addRow(), deleteColumn(), deleteRow(), and setIndex().

◆ isInsertion()

bool ModifyTemplateGridCommand::isInsertion ( ) const
Returns
true if the row/column is inserted, false if it is deleted

Definition at line 383 of file templatecommands.cpp.

References insertion_.

◆ redo()

void ModifyTemplateGridCommand::redo ( )
override

Redo the change.

Definition at line 405 of file templatecommands.cpp.

References apply().

◆ setCells()

void ModifyTemplateGridCommand::setCells ( const QList< TitleBlockCell *> &  cells)

Set the cells composing the inserted/deleted row/column.

Parameters
cellsList of pointers to cells composing the inserted/deleted row/column.

Definition at line 345 of file templatecommands.cpp.

References cells(), and cells_.

Referenced by addColumn(), and addRow().

◆ setDimension()

void ModifyTemplateGridCommand::setDimension ( const TitleBlockDimension dimension)

Set the dimension of the inserted/deleted row/column

Parameters
dimensionDimension of the inserted/deleted row/column

Definition at line 360 of file templatecommands.cpp.

References dimension(), and dimension_.

Referenced by addColumn(), and addRow().

◆ setIndex()

void ModifyTemplateGridCommand::setIndex ( int  index)

Set the index of the inserted/deleted row/column.

Parameters
indexIndex of the inserted/deleted row/column.

Definition at line 330 of file templatecommands.cpp.

References index(), and index_.

Referenced by addColumn(), addRow(), deleteColumn(), and deleteRow().

◆ setInsertion()

void ModifyTemplateGridCommand::setInsertion ( bool  insertion)
Parameters
insertiontrue if the row/column is inserted, false if it is deleted

Definition at line 390 of file templatecommands.cpp.

References insertion_, and updateText().

Referenced by addColumn(), addRow(), deleteColumn(), and deleteRow().

◆ setType()

void ModifyTemplateGridCommand::setType ( bool  type)

Indicates whether this object inserts/deletes a row or a column.

Parameters
typetrue if this object is about inserting/deleting a row, false for a column.

Definition at line 375 of file templatecommands.cpp.

References type(), type_, and updateText().

Referenced by addColumn(), addRow(), deleteColumn(), and deleteRow().

◆ type()

int ModifyTemplateGridCommand::type ( ) const
Returns
true if this object is about inserting/deleting a row, false for a column.

Definition at line 367 of file templatecommands.cpp.

References type_.

Referenced by setType().

◆ undo()

void ModifyTemplateGridCommand::undo ( )
override

Undo the change.

Definition at line 398 of file templatecommands.cpp.

References apply().

Referenced by apply().

◆ updateText()

void ModifyTemplateGridCommand::updateText ( )
private

Update the text describing what the command does.

Definition at line 412 of file templatecommands.cpp.

References insertion_, QET::Icons::tr, and type_.

Referenced by ModifyTemplateGridCommand(), setInsertion(), and setType().

Member Data Documentation

◆ cells_

QList<TitleBlockCell *> ModifyTemplateGridCommand::cells_
private

Cells composing the inserted/deleted row/column.

Definition at line 130 of file templatecommands.h.

Referenced by apply(), cells(), and setCells().

◆ dimension_

TitleBlockDimension ModifyTemplateGridCommand::dimension_
private

width/height of the column/row, which interpretation depends on type_

Definition at line 132 of file templatecommands.h.

Referenced by apply(), dimension(), and setDimension().

◆ index_

int ModifyTemplateGridCommand::index_
private

Index of the inserted/deleted row/column.

Definition at line 129 of file templatecommands.h.

Referenced by apply(), index(), and setIndex().

◆ insertion_

bool ModifyTemplateGridCommand::insertion_
private

Definition at line 133 of file templatecommands.h.

Referenced by apply(), isInsertion(), setInsertion(), and updateText().

◆ type_

bool ModifyTemplateGridCommand::type_
private

true for a row, false for a column

Definition at line 131 of file templatecommands.h.

Referenced by apply(), setType(), type(), and updateText().


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