MCPcopy Create free account
hub / github.com/KDAB/KDChart / justifyModelSize

Method justifyModelSize

src/KDChart/KDChartWidget.cpp:597–612  ·  view source on GitHub ↗

* Justifies the model, so that the given rows and columns fit into it. */

Source from the content-addressed store, hash-verified

595 * Justifies the model, so that the given rows and columns fit into it.
596 */
597void 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}

Callers

nothing calls this directly

Calls 3

insertRowsMethod · 0.80
rowCountMethod · 0.45
columnCountMethod · 0.45

Tested by

no test coverage detected