| 3407 | } |
| 3408 | |
| 3409 | void SpreadsheetView::removeSelectedRows() { |
| 3410 | if (firstSelectedRow() < 0) |
| 3411 | return; |
| 3412 | |
| 3413 | WAIT_CURSOR; |
| 3414 | const auto& columns = m_spreadsheet->children<Column>(); |
| 3415 | m_spreadsheet->beginMacro(i18n("%1: remove selected rows", m_spreadsheet->name())); |
| 3416 | // suppress the dataChanged signal, will be emitted at the end after all rows were removed |
| 3417 | for (auto* column : columns) |
| 3418 | column->setSuppressDataChangedSignal(true); |
| 3419 | |
| 3420 | // remove rows |
| 3421 | for (const auto& i : selectedRows().intervals()) |
| 3422 | m_spreadsheet->removeRows(i.start(), i.size()); |
| 3423 | |
| 3424 | // emit the dataChanged signal |
| 3425 | for (auto* column : columns) { |
| 3426 | column->setSuppressDataChangedSignal(false); |
| 3427 | column->setChanged(); |
| 3428 | } |
| 3429 | |
| 3430 | m_spreadsheet->endMacro(); |
| 3431 | RESET_CURSOR; |
| 3432 | } |
| 3433 | |
| 3434 | void SpreadsheetView::clearSelectedCells() { |
| 3435 | // don't try to clear values if the selected cells don't have any values at all |
nothing calls this directly
no test coverage detected