| 1556 | } |
| 1557 | |
| 1558 | void SpreadsheetView::checkSpreadsheetSelectionMenu() { |
| 1559 | // deactivate mask/unmask actions for the selection |
| 1560 | // if there are no unmasked/masked cells in the current selection |
| 1561 | const QModelIndexList& indexes = m_tableView->selectionModel()->selectedIndexes(); |
| 1562 | bool hasMasked = false; |
| 1563 | bool hasUnmasked = false; |
| 1564 | for (auto& index : std::as_const(indexes)) { |
| 1565 | int row = index.row(); |
| 1566 | int col = index.column(); |
| 1567 | const auto* column = m_spreadsheet->column(col); |
| 1568 | // TODO: the null pointer check shouldn't be actually required here |
| 1569 | // but when deleting the columns the selection model in the view |
| 1570 | // and the aspect model sometimes get out of sync and we crash... |
| 1571 | if (!column) |
| 1572 | break; |
| 1573 | |
| 1574 | if (!hasMasked && column->isMasked(row)) |
| 1575 | hasMasked = true; |
| 1576 | |
| 1577 | if (!hasUnmasked && !column->isMasked(row)) |
| 1578 | hasUnmasked = true; |
| 1579 | |
| 1580 | if (hasMasked && hasUnmasked) |
| 1581 | break; |
| 1582 | } |
| 1583 | |
| 1584 | action_mask_selection->setEnabled(hasUnmasked); |
| 1585 | action_unmask_selection->setEnabled(hasMasked); |
| 1586 | } |
| 1587 | |
| 1588 | void SpreadsheetView::checkColumnMenus(const QVector<Column*>& columns) { |
| 1589 | bool numeric = true; |
nothing calls this directly
no test coverage detected