* Justifies the model, so that the given rows and columns fit into it. */
| 595 | * Justifies the model, so that the given rows and columns fit into it. |
| 596 | */ |
| 597 | void Widget::justifyModelSize(int rows, int columns) |
| 598 | { |
| 599 | QAbstractItemModel &model = d->m_model; |
| 600 | const int currentRows = model.rowCount(); |
| 601 | const int currentCols = model.columnCount(); |
| 602 | |
| 603 | if (currentCols < columns) |
| 604 | if (!model.insertColumns(currentCols, columns - currentCols)) |
| 605 | qDebug() << "justifyModelSize: could not increase model size."; |
| 606 | if (currentRows < rows) |
| 607 | if (!model.insertRows(currentRows, rows - currentRows)) |
| 608 | qDebug() << "justifyModelSize: could not increase model size."; |
| 609 | |
| 610 | Q_ASSERT(model.rowCount() >= rows); |
| 611 | Q_ASSERT(model.columnCount() >= columns); |
| 612 | } |
nothing calls this directly
no test coverage detected