! \internal Creates a QCPItemPosition, registers it with this item and returns a pointer to it. The specified \a name must be a unique string that is usually identical to the variable name of the position member (This is needed to provide the name-based \ref position access to positions). Don't delete positions created by this function manually, as the item will take care of it. U
| 13188 | \see createAnchor |
| 13189 | */ |
| 13190 | QCPItemPosition *QCPAbstractItem::createPosition(const QString &name) |
| 13191 | { |
| 13192 | if (hasAnchor(name)) |
| 13193 | qDebug() << Q_FUNC_INFO << "anchor/position with name exists already:" << name; |
| 13194 | QCPItemPosition *newPosition = new QCPItemPosition(mParentPlot, this, name); |
| 13195 | mPositions.append(newPosition); |
| 13196 | mAnchors.append(newPosition); // every position is also an anchor |
| 13197 | newPosition->setAxes(mParentPlot->xAxis, mParentPlot->yAxis); |
| 13198 | newPosition->setType(QCPItemPosition::ptPlotCoords); |
| 13199 | if (mParentPlot->axisRect()) |
| 13200 | newPosition->setAxisRect(mParentPlot->axisRect()); |
| 13201 | newPosition->setCoords(0, 0); |
| 13202 | return newPosition; |
| 13203 | } |
| 13204 | |
| 13205 | /*! \internal |
| 13206 |