! Inserts a new column with empty cells at the column index \a newIndex. Valid values for \a newIndex range from 0 (inserts a column at the left) to \a columnCount (appends a column at the right). \see insertRow */
| 4466 | \see insertRow |
| 4467 | */ |
| 4468 | void QCPLayoutGrid::insertColumn(int newIndex) |
| 4469 | { |
| 4470 | if (mElements.isEmpty() || mElements.first().isEmpty()) // if grid is completely empty, add first cell |
| 4471 | { |
| 4472 | expandTo(1, 1); |
| 4473 | return; |
| 4474 | } |
| 4475 | |
| 4476 | if (newIndex < 0) |
| 4477 | newIndex = 0; |
| 4478 | if (newIndex > columnCount()) |
| 4479 | newIndex = columnCount(); |
| 4480 | |
| 4481 | mColumnStretchFactors.insert(newIndex, 1); |
| 4482 | for (int row=0; row<rowCount(); ++row) |
| 4483 | mElements[row].insert(newIndex, (QCPLayoutElement*)0); |
| 4484 | } |
| 4485 | |
| 4486 | /*! |
| 4487 | Converts the given \a row and \a column to the linear index used by some methods of \ref |
no test coverage detected