! Inserts a new row with empty cells at the row index \a newIndex. Valid values for \a newIndex range from 0 (inserts a row at the top) to \a rowCount (appends a row at the bottom). \see insertColumn */
| 4464 | \see insertColumn |
| 4465 | */ |
| 4466 | void QCPLayoutGrid::insertRow(int newIndex) |
| 4467 | { |
| 4468 | if (mElements.isEmpty() || mElements.first().isEmpty()) // if grid is completely empty, add first cell |
| 4469 | { |
| 4470 | expandTo(1, 1); |
| 4471 | return; |
| 4472 | } |
| 4473 | |
| 4474 | if (newIndex < 0) |
| 4475 | newIndex = 0; |
| 4476 | if (newIndex > rowCount()) |
| 4477 | newIndex = rowCount(); |
| 4478 | |
| 4479 | mRowStretchFactors.insert(newIndex, 1); |
| 4480 | QList<QCPLayoutElement*> newRow; |
| 4481 | for (int col=0; col<columnCount(); ++col) |
| 4482 | newRow.append(nullptr); |
| 4483 | mElements.insert(newIndex, newRow); |
| 4484 | } |
| 4485 | |
| 4486 | /*! |
| 4487 | Inserts a new column with empty cells at the column index \a newIndex. Valid values for \a |
no test coverage detected