Aquila  2.0 prealpha
Cognitive Robotics Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QCPItemAnchor Class Reference

An anchor of an item to which positions can be attached to. More...

#include <plot2d.h>

Inheritance diagram for QCPItemAnchor:

Public Member Functions

 QCPItemAnchor (QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1)
virtual ~QCPItemAnchor ()
QString name () const
virtual QPointF pixelPoint () const

Protected Member Functions

void addChild (QCPItemPosition *pos)
void removeChild (QCPItemPosition *pos)

Protected Attributes

int mAnchorId
QString mName
QSet< QCPItemPosition * > mChildren


class QCPItemPosition

Detailed Description

An anchor of an item to which positions can be attached to.

An item (QCPAbstractItem) may have one or more anchors. Unlike QCPItemPosition, an anchor doesn't control anything on its item, but provides a way to tie other items via their positions to the anchor.

For example, a QCPItemRect is defined by its positions topLeft and bottomRight. Additionally it has various anchors like top, topRight or bottomLeft etc. So you can attach the start (which is a QCPItemPosition) of a QCPItemLine to one of the anchors by calling QCPItemPosition::setParentAnchor on start, passing the wanted anchor of the QCPItemRect. This way the start of the line will now always follow the respective anchor location on the rect item.

Note that QCPItemPosition derives from QCPItemAnchor, so every position can also serve as an anchor to other positions.

To learn how to provide anchors in your own item subclasses, see the subclassing section of the QCPAbstractItem documentation.

Constructor & Destructor Documentation

QCPItemAnchor::QCPItemAnchor ( QCustomPlot parentPlot,
QCPAbstractItem parentItem,
const QString  name,
int  anchorId = -1 

Creates a new QCPItemAnchor. You shouldn't create QCPItemAnchor instances directly, even if you want to make a new item subclass. Use QCPAbstractItem::createAnchor instead, as explained in the subclassing section of the QCPAbstractItem documentation.

QCPItemAnchor::~QCPItemAnchor ( )

Member Function Documentation

void QCPItemAnchor::addChild ( QCPItemPosition pos)
QString QCPItemAnchor::name ( ) const
QPointF QCPItemAnchor::pixelPoint ( ) const

Returns the final absolute pixel position of the QCPItemAnchor on the QCustomPlot surface.

The pixel information is internally retrieved via QCPAbstractItem::anchorPixelPosition of the parent item, QCPItemAnchor is just an intermediary.

Reimplemented in QCPItemPosition.

void QCPItemAnchor::removeChild ( QCPItemPosition pos)

Friends And Related Function Documentation

friend class QCPItemPosition

Member Data Documentation

int QCPItemAnchor::mAnchorId
QSet<QCPItemPosition*> QCPItemAnchor::mChildren
QString QCPItemAnchor::mName
QCPAbstractItem* QCPItemAnchor::mParentItem
QCustomPlot* QCPItemAnchor::mParentPlot

The documentation for this class was generated from the following files: