Spreadsheet: add new API PropertySheet::getNonEmptyCells()

To exclude cells without any text content. Used when printing (among
other cases) to skip empty cells.
This commit is contained in:
Zheng, Lei
2022-05-06 11:07:28 +08:00
committed by Chris Hennes
parent 3bea43a228
commit 6d6af2dd3b
4 changed files with 27 additions and 15 deletions

View File

@@ -769,7 +769,7 @@ void SheetTableView::finishEditWithMove(int keyPressed, Qt::KeyboardModifiers mo
{
// End should take you to the last occupied cell in the current column
// Ctrl-End takes you to the last cell in the sheet
auto usedCells = sheet->getCells()->getUsedCells();
auto usedCells = sheet->getCells()->getNonEmptyCells();
for (const auto& cell : usedCells) {
if (modifiers == Qt::NoModifier) {
if (cell.col() == targetColumn)
@@ -984,7 +984,7 @@ void SheetTableView::contextMenuEvent(QContextMenuEvent *)
QString SheetTableView::toHtml() const
{
std::set<App::CellAddress> cells = sheet->getCells()->getUsedCells();
auto cells = sheet->getCells()->getNonEmptyCells();
int rowCount = 1;
int colCount = 1;
for (const auto& it : cells) {