[qet] [1637] TBT editor: added menu entries to add rows/ columns at the end of the grid. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1637
Author: xavier
Date: 2012-04-08 22:51:43 +0200 (Sun, 08 Apr 2012)
Log Message:
-----------
TBT editor: added menu entries to add rows/columns at the end of the grid.
Modified Paths:
--------------
branches/0.3/sources/titleblock/qettemplateeditor.cpp
branches/0.3/sources/titleblock/qettemplateeditor.h
branches/0.3/sources/titleblock/templateview.cpp
branches/0.3/sources/titleblock/templateview.h
Modified: branches/0.3/sources/titleblock/qettemplateeditor.cpp
===================================================================
--- branches/0.3/sources/titleblock/qettemplateeditor.cpp 2012-04-08 20:51:40 UTC (rev 1636)
+++ branches/0.3/sources/titleblock/qettemplateeditor.cpp 2012-04-08 20:51:43 UTC (rev 1637)
@@ -304,6 +304,8 @@
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 @@
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 @@
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 @@
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);
}
Modified: branches/0.3/sources/titleblock/qettemplateeditor.h
===================================================================
--- branches/0.3/sources/titleblock/qettemplateeditor.h 2012-04-08 20:51:40 UTC (rev 1636)
+++ branches/0.3/sources/titleblock/qettemplateeditor.h 2012-04-08 20:51:43 UTC (rev 1637)
@@ -49,7 +49,7 @@
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_;
Modified: branches/0.3/sources/titleblock/templateview.cpp
===================================================================
--- branches/0.3/sources/titleblock/templateview.cpp 2012-04-08 20:51:40 UTC (rev 1636)
+++ branches/0.3/sources/titleblock/templateview.cpp 2012-04-08 20:51:43 UTC (rev 1637)
@@ -258,6 +258,22 @@
}
/**
+ 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.
*/
Modified: branches/0.3/sources/titleblock/templateview.h
===================================================================
--- branches/0.3/sources/titleblock/templateview.h 2012-04-08 20:51:40 UTC (rev 1636)
+++ branches/0.3/sources/titleblock/templateview.h 2012-04-08 20:51:43 UTC (rev 1637)
@@ -63,6 +63,8 @@
bool mayPaste();
QList<TitleBlockCell> pastedCells();
void paste();
+ void addColumnAtEnd();
+ void addRowAtEnd();
void addColumnBefore();
void addRowBefore();
void addColumnAfter();