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:
xavier
2012-03-11 16:06:43 +00:00
parent ab3caba9ef
commit f6b2037fb9
4 changed files with 98 additions and 8 deletions

View File

@@ -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