MCPcopy Create free account
hub / github.com/KDE/labplot / insertColumns

Method insertColumns

src/backend/spreadsheet/Spreadsheet.cpp:638–656  ·  view source on GitHub ↗

! * 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. */

Source from the content-addressed store, hash-verified

636 * @param before The column index before which the columns are inserted.
637 */
638void 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.

Callers

nothing calls this directly

Calls 4

columnCountFunction · 0.85
rowCountFunction · 0.85
setPlotDesignationMethod · 0.45
insertRowsMethod · 0.45

Tested by

no test coverage detected