mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Title block template editor: implemented cut operation.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1561 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -849,6 +849,59 @@ void ChangeTemplateInformationsCommand::redo() {
|
||||
tbtemplate_ -> setInformation(new_information_);
|
||||
}
|
||||
|
||||
/**
|
||||
Constructor
|
||||
*/
|
||||
CutTemplateCellsCommand::CutTemplateCellsCommand(TitleBlockTemplate *tb_template, QUndoCommand *parent) :
|
||||
TitleBlockTemplateCommand(tb_template, parent)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
CutTemplateCellsCommand::~CutTemplateCellsCommand() {
|
||||
}
|
||||
|
||||
/**
|
||||
Undo a cut operation
|
||||
*/
|
||||
void CutTemplateCellsCommand::undo() {
|
||||
foreach (TitleBlockCell *cell, cut_cells_.keys()) {
|
||||
cell -> cell_type = cut_cells_.value(cell);
|
||||
}
|
||||
if (view_) {
|
||||
view_ -> refresh();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Redo a cut operation
|
||||
*/
|
||||
void CutTemplateCellsCommand::redo() {
|
||||
foreach (TitleBlockCell *cell, cut_cells_.keys()) {
|
||||
cell -> cell_type = TitleBlockCell::EmptyCell;
|
||||
}
|
||||
if (view_) {
|
||||
view_ -> refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void CutTemplateCellsCommand::setCutCells(const QList<TitleBlockCell *> &cells) {
|
||||
foreach (TitleBlockCell *cell, cells) {
|
||||
cut_cells_.insert(cell, cell -> cell_type);
|
||||
}
|
||||
updateText();
|
||||
}
|
||||
|
||||
/**
|
||||
Update the label describing this command
|
||||
*/
|
||||
void CutTemplateCellsCommand::updateText() {
|
||||
setText(QObject::tr("Couper %n cellule(s)", "undo caption", cut_cells_.count()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@param tb_template Changed title block template
|
||||
|
||||
Reference in New Issue
Block a user