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

#include <templatecommands.h>

Public Member Functions

 MergeCellsCommand (const TitleBlockTemplateCellsSet &, TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
 
 ~MergeCellsCommand () override
 
bool isValid () const
 
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 bool canMerge (const TitleBlockTemplateCellsSet &, TitleBlockTemplate *)
 

Static Private Member Functions

static TitleBlockCellgetBottomRightCell (const TitleBlockTemplateCellsSet &)
 

Private Attributes

TitleBlockCellspanning_cell_
 the cell spanning over the other ones More...
 
QHash< TitleBlockCell *, TitleBlockCell * > spanner_cells_before_merge_
 
int row_span_before_
 the row_span attribute of the spanning cell before the merge More...
 
int col_span_before_
 the col_span attribute of the spanning cell before the merge More...
 
int applied_row_span_before_
 the applied_row_span attribute of the spanning cell before the merge More...
 
int applied_col_span_before_
 the applied_col_span attribute of the spanning cell before the merge More...
 
int span_state_before_
 the span_state attribute of the spanning cell before the merge More...
 
int row_span_after_
 the row_span attribute of the spanning cell after the merge More...
 
int col_span_after_
 the col_span attribute of the spanning cell after the merge More...
 

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 merging 2 to n cells into a single one.

Definition at line 177 of file templatecommands.h.

Constructor & Destructor Documentation

◆ MergeCellsCommand()

MergeCellsCommand::MergeCellsCommand ( const TitleBlockTemplateCellsSet merged_cells,
TitleBlockTemplate tbtemplate = nullptr,
QUndoCommand *  parent = nullptr 
)

Construct a command object that acts on tbtemplate in order to merge merged_cells. Note: you should check the resulting object is valid using isValid().

Parameters
merged_cellsCells to be merged together into a single one.
tbtemplateModified title block template.
parentParent QUndoCommand.

Definition at line 589 of file templatecommands.cpp.

References applied_col_span_before_, applied_row_span_before_, canMerge(), TitleBlockTemplateCellsSet::cells(), col_span_after_, col_span_before_, getBottomRightCell(), row_span_after_, row_span_before_, span_state_before_, spanner_cells_before_merge_, spanning_cell_, TitleBlockTemplateCellsSet::topLeftCell(), and QET::Icons::tr.

◆ ~MergeCellsCommand()

MergeCellsCommand::~MergeCellsCommand ( )
override

Destructor

Definition at line 634 of file templatecommands.cpp.

Member Function Documentation

◆ canMerge()

bool MergeCellsCommand::canMerge ( const TitleBlockTemplateCellsSet merged_cells,
TitleBlockTemplate tbtemplate 
)
static
Parameters
merged_cellsCell sto be merged.
tbtemplateModified title block template.
Returns
true if the merge is feasible, false otherwise

Definition at line 642 of file templatecommands.cpp.

References getBottomRightCell(), TitleBlockTemplateCellsSet::isRectangle(), and TitleBlockTemplateCellsSet::topLeftCell().

Referenced by TitleBlockTemplateView::analyzeSelectedCells(), and MergeCellsCommand().

◆ getBottomRightCell()

TitleBlockCell * MergeCellsCommand::getBottomRightCell ( const TitleBlockTemplateCellsSet cells_set)
staticprivate
Parameters
cells_setSet of title block template visual cells.
Returns
the bottom right logical cell within a set of visual cells.

Definition at line 713 of file templatecommands.cpp.

References TitleBlockTemplateCellsSet::bottomRightCell().

Referenced by canMerge(), and MergeCellsCommand().

◆ isValid()

bool MergeCellsCommand::isValid ( ) const
Returns
true if this command object is valid and usable, false otherwise.

Definition at line 661 of file templatecommands.cpp.

References col_span_after_, row_span_after_, and spanning_cell_.

Referenced by redo(), and undo().

◆ redo()

void MergeCellsCommand::redo ( )
override

◆ undo()

void MergeCellsCommand::undo ( )
override

Member Data Documentation

◆ applied_col_span_before_

int MergeCellsCommand::applied_col_span_before_
private

the applied_col_span attribute of the spanning cell before the merge

Definition at line 202 of file templatecommands.h.

Referenced by MergeCellsCommand(), and undo().

◆ applied_row_span_before_

int MergeCellsCommand::applied_row_span_before_
private

the applied_row_span attribute of the spanning cell before the merge

Definition at line 201 of file templatecommands.h.

Referenced by MergeCellsCommand(), and undo().

◆ col_span_after_

int MergeCellsCommand::col_span_after_
private

the col_span attribute of the spanning cell after the merge

Definition at line 205 of file templatecommands.h.

Referenced by isValid(), MergeCellsCommand(), and redo().

◆ col_span_before_

int MergeCellsCommand::col_span_before_
private

the col_span attribute of the spanning cell before the merge

Definition at line 200 of file templatecommands.h.

Referenced by MergeCellsCommand(), and undo().

◆ row_span_after_

int MergeCellsCommand::row_span_after_
private

the row_span attribute of the spanning cell after the merge

Definition at line 204 of file templatecommands.h.

Referenced by isValid(), MergeCellsCommand(), and redo().

◆ row_span_before_

int MergeCellsCommand::row_span_before_
private

the row_span attribute of the spanning cell before the merge

Definition at line 199 of file templatecommands.h.

Referenced by MergeCellsCommand(), and undo().

◆ span_state_before_

int MergeCellsCommand::span_state_before_
private

the span_state attribute of the spanning cell before the merge

Definition at line 203 of file templatecommands.h.

Referenced by MergeCellsCommand(), and undo().

◆ spanner_cells_before_merge_

QHash<TitleBlockCell *, TitleBlockCell *> MergeCellsCommand::spanner_cells_before_merge_
private

hash associating spanned cells with their spanner_cell attribute before the merge operation

Definition at line 198 of file templatecommands.h.

Referenced by MergeCellsCommand(), redo(), and undo().

◆ spanning_cell_

TitleBlockCell* MergeCellsCommand::spanning_cell_
private

the cell spanning over the other ones

Definition at line 195 of file templatecommands.h.

Referenced by isValid(), MergeCellsCommand(), redo(), and undo().


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