! * Inserts \c count columns before the \c before column index in the spreadsheet. * @param count The number of columns to insert. * @param before The column index before which the columns are inserted. */
| 636 | * @param before The column index before which the columns are inserted. |
| 637 | */ |
| 638 | void Spreadsheet::insertColumns(int before, int count) { |
| 639 | WAIT_CURSOR; |
| 640 | beginMacro(i18np("%1: insert 1 column", "%1: insert %2 columns", name(), count)); |
| 641 | const int cols = columnCount(); |
| 642 | const int rows = rowCount(); |
| 643 | const int last = before + count - 1; |
| 644 | Q_EMIT aspectsAboutToBeInserted(before, last); |
| 645 | for (int i = 0; i < count; i++) { |
| 646 | auto* new_col = new Column(QString::number(cols + i + 1), AbstractColumn::ColumnMode::Double); |
| 647 | new_col->setPlotDesignation(AbstractColumn::PlotDesignation::Y); |
| 648 | new_col->insertRows(0, rows); |
| 649 | insertChild(new_col, before + i); |
| 650 | } |
| 651 | Q_EMIT aspectsInserted(before, last); |
| 652 | |
| 653 | exec(new SpreadsheetSetColumnsCountCmd(this, cols, columnCount())); |
| 654 | endMacro(); |
| 655 | RESET_CURSOR; |
| 656 | } |
| 657 | |
| 658 | /*! |
| 659 | * Clears all values in the spreadsheet. |
nothing calls this directly
no test coverage detected