! Returns the QCPItemAnchor with the specified \a name. If this item doesn't have an anchor by that name, returns 0. This function provides an alternative way to access item anchors. Normally, you access anchors direcly by their member pointers (which typically have the same variable name as \a name). \see anchors, position */
| 12338 | \see anchors, position |
| 12339 | */ |
| 12340 | QCPItemAnchor *QCPAbstractItem::anchor(const QString &name) const |
| 12341 | { |
| 12342 | for (int i=0; i<mAnchors.size(); ++i) |
| 12343 | { |
| 12344 | if (mAnchors.at(i)->name() == name) |
| 12345 | return mAnchors.at(i); |
| 12346 | } |
| 12347 | qDebug() << Q_FUNC_INFO << "anchor with name not found:" << name; |
| 12348 | return 0; |
| 12349 | } |
| 12350 | |
| 12351 | /*! |
| 12352 | Returns whether this item has an anchor with the specified \a name. |