! \overload Adds the \a element to cell with \a row and \a column. If \a element is already in a layout, it is first removed from there. If \a row or \a column don't exist yet, the layout is expanded accordingly. Returns true if the element was added successfully, i.e. if the cell at \a row and \a column didn't already have an element. Use the overload of this method without explici
| 4132 | \see element, hasElement, take, remove |
| 4133 | */ |
| 4134 | bool QCPLayoutGrid::addElement(int row, int column, QCPLayoutElement *element) |
| 4135 | { |
| 4136 | if (!hasElement(row, column)) |
| 4137 | { |
| 4138 | if (element && element->layout()) // remove from old layout first |
| 4139 | element->layout()->take(element); |
| 4140 | expandTo(row+1, column+1); |
| 4141 | mElements[row][column] = element; |
| 4142 | if (element) |
| 4143 | adoptElement(element); |
| 4144 | return true; |
| 4145 | } else |
| 4146 | qDebug() << Q_FUNC_INFO << "There is already an element in the specified row/column:" << row << column; |
| 4147 | return false; |
| 4148 | } |
| 4149 | |
| 4150 | /*! \overload |
| 4151 |
no test coverage detected