diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 4ecbbc68e..3ac00f8f3 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -304,6 +304,8 @@ void QETTitleBlockTemplateEditor::initActions() { zoom_out_ = new QAction(QET::Icons::ZoomOut, tr("Zoom arri\350re", "menu entry"), this); zoom_fit_ = new QAction(QET::Icons::ZoomFitBest, tr("Zoom adapt\351", "menu entry"), this); zoom_reset_ = new QAction(QET::Icons::ZoomOriginal, tr("Pas de zoom", "menu entry"), this); + add_row_ = new QAction(QET::Icons::EditTableInsertRowAbove, tr("Ajouter une &ligne", "menu entry"), this); + add_col_ = new QAction(QET::Icons::EditTableInsertColumnRight, tr("Ajouter une &colonne", "menu entry"), this); merge_cells_ = new QAction(QET::Icons::EditTableCellMerge, tr("&Fusionner les cellules", "menu entry"), this); split_cell_ = new QAction(QET::Icons::EditTableCellSplit, tr("&S\351parer les cellules", "menu entry"), this); @@ -344,6 +346,8 @@ void QETTitleBlockTemplateEditor::initActions() { connect(zoom_fit_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomFit())); connect(zoom_reset_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomReset())); connect(edit_info_, SIGNAL(triggered()), this, SLOT(editTemplateInformation())); + connect(add_row_, SIGNAL(triggered()), template_edition_area_view_, SLOT(addRowAtEnd())); + connect(add_col_, SIGNAL(triggered()), template_edition_area_view_, SLOT(addColumnAtEnd())); connect(merge_cells_, SIGNAL(triggered()), template_edition_area_view_, SLOT(mergeSelectedCells())); connect(split_cell_, SIGNAL(triggered()), template_edition_area_view_, SLOT(splitSelectedCell())); } @@ -372,8 +376,11 @@ void QETTitleBlockTemplateEditor::initMenus() { edit_menu_ -> addAction(copy_); edit_menu_ -> addAction(paste_); edit_menu_ -> addSeparator(); + edit_menu_ -> addAction(add_row_); + edit_menu_ -> addAction(add_col_); edit_menu_ -> addAction(merge_cells_); edit_menu_ -> addAction(split_cell_); + edit_menu_ -> addSeparator(); edit_menu_ -> addAction(edit_info_); display_menu_ -> addAction(zoom_in_); display_menu_ -> addAction(zoom_out_); @@ -582,6 +589,8 @@ void QETTitleBlockTemplateEditor::updateActions() { cut_ -> setEnabled(!read_only_ && count); copy_ -> setEnabled(count); paste_ -> setEnabled(!read_only_ && count && template_edition_area_view_ -> mayPaste()); + add_row_ -> setEnabled(!read_only_); + add_col_ -> setEnabled(!read_only_); merge_cells_ -> setEnabled(!read_only_ && can_merge); split_cell_ -> setEnabled(!read_only_ && can_split); } diff --git a/sources/titleblock/qettemplateeditor.h b/sources/titleblock/qettemplateeditor.h index fd1557ea7..71706ee2c 100644 --- a/sources/titleblock/qettemplateeditor.h +++ b/sources/titleblock/qettemplateeditor.h @@ -49,7 +49,7 @@ class QETTitleBlockTemplateEditor : public QETMainWindow { QMenu *file_menu_, *edit_menu_,/* *paste_from_menu_, */*display_menu_,/* *tools_menu_*/; /// actions QAction *new_, *open_, *open_from_file_, *save_, *save_as_, *save_as_file_, *quit_; - QAction *undo_, *redo_, *cut_, *copy_, *paste_, *edit_info_, *merge_cells_, *split_cell_; + QAction *undo_, *redo_, *cut_, *copy_, *paste_, *edit_info_, *add_row_, *add_col_, *merge_cells_, *split_cell_; QAction *zoom_in_, *zoom_out_, *zoom_fit_, *zoom_reset_; /// Location of the currently edited template TitleBlockTemplateLocation location_; diff --git a/sources/titleblock/templateview.cpp b/sources/titleblock/templateview.cpp index 1a603d48c..df64bc1fa 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -257,6 +257,22 @@ void TitleBlockTemplateView::paste() { requestGridModification(paste_command); } +/** + Add a column right after the last one. +*/ +void TitleBlockTemplateView::addColumnAtEnd() { + if (read_only_) return; + requestGridModification(ModifyTemplateGridCommand::addColumn(tbtemplate_, tbtemplate_ -> columnsCount())); +} + +/** + Add a row right after the last one. +*/ +void TitleBlockTemplateView::addRowAtEnd() { + if (read_only_) return; + requestGridModification(ModifyTemplateGridCommand::addRow(tbtemplate_, tbtemplate_ -> rowsCount())); +} + /** Add a column right before the last index selected when calling the context menu. diff --git a/sources/titleblock/templateview.h b/sources/titleblock/templateview.h index f6c638ac5..6885188b8 100644 --- a/sources/titleblock/templateview.h +++ b/sources/titleblock/templateview.h @@ -63,6 +63,8 @@ class TitleBlockTemplateView : public QGraphicsView { bool mayPaste(); QList pastedCells(); void paste(); + void addColumnAtEnd(); + void addRowAtEnd(); void addColumnBefore(); void addRowBefore(); void addColumnAfter();