Gra zręcznościowa „Straszna Epidemia"  V1.2
Projekt Wizualizacja Danych Sensorycznych Kewin Gałuszka rok akademicki 2019/2020
Dokumentacja klasy QCPItemPosition

Manages the position of an item. Więcej...

#include <qcustomplot.h>

Diagram dziedziczenia dla QCPItemPosition
Diagram współpracy dla QCPItemPosition:

Typy publiczne

enum  PositionType { ptAbsolute, ptViewportRatio, ptAxisRectRatio, ptPlotCoords }
 

Metody publiczne

 QCPItemPosition (QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name)
 
virtual ~QCPItemPosition ()
 
PositionType type () const
 
PositionType typeX () const
 
PositionType typeY () const
 
QCPItemAnchorparentAnchor () const
 
QCPItemAnchorparentAnchorX () const
 
QCPItemAnchorparentAnchorY () const
 
double key () const
 
double value () const
 
QPointF coords () const
 
QCPAxiskeyAxis () const
 
QCPAxisvalueAxis () const
 
QCPAxisRectaxisRect () const
 
virtual QPointF pixelPosition () const Q_DECL_OVERRIDE
 
void setType (PositionType type)
 
void setTypeX (PositionType type)
 
void setTypeY (PositionType type)
 
bool setParentAnchor (QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
 
bool setParentAnchorX (QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
 
bool setParentAnchorY (QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
 
void setCoords (double key, double value)
 
void setCoords (const QPointF &coords)
 
void setAxes (QCPAxis *keyAxis, QCPAxis *valueAxis)
 
void setAxisRect (QCPAxisRect *axisRect)
 
void setPixelPosition (const QPointF &pixelPosition)
 
- Metody publiczne dziedziczone z QCPItemAnchor
 QCPItemAnchor (QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1)
 
virtual ~QCPItemAnchor ()
 
QString name () const
 

Metody chronione

virtual QCPItemPositiontoQCPItemPosition () Q_DECL_OVERRIDE
 
- Metody chronione dziedziczone z QCPItemAnchor
void addChildX (QCPItemPosition *pos)
 
void removeChildX (QCPItemPosition *pos)
 
void addChildY (QCPItemPosition *pos)
 
void removeChildY (QCPItemPosition *pos)
 

Atrybuty chronione

PositionType mPositionTypeX
 
PositionType mPositionTypeY
 
QPointer< QCPAxismKeyAxis
 
QPointer< QCPAxismValueAxis
 
QPointer< QCPAxisRectmAxisRect
 
double mKey
 
double mValue
 
QCPItemAnchormParentAnchorX
 
QCPItemAnchormParentAnchorY
 
- Atrybuty chronione dziedziczone z QCPItemAnchor
QString mName
 
QCustomPlotmParentPlot
 
QCPAbstractItemmParentItem
 
int mAnchorId
 
QSet< QCPItemPosition * > mChildrenX
 
QSet< QCPItemPosition * > mChildrenY
 

Opis szczegółowy

Manages the position of an item.

Every item has at least one public QCPItemPosition member pointer which provides ways to position the item on the QCustomPlot surface. Some items have multiple positions, for example QCPItemRect has two: topLeft and bottomRight.

QCPItemPosition has a type (PositionType) that can be set with setType. This type defines how coordinates passed to setCoords are to be interpreted, e.g. as absolute pixel coordinates, as plot coordinates of certain axes, etc. For more advanced plots it is also possible to assign different types per X/Y coordinate of the position (see setTypeX, setTypeY). This way an item could be positioned at a fixed pixel distance from the top in the Y direction, while following a plot coordinate in the X direction.

A QCPItemPosition may have a parent QCPItemAnchor, see setParentAnchor. This way you can tie multiple items together. If the QCPItemPosition has a parent, its coordinates (setCoords) are considered to be absolute pixels in the reference frame of the parent anchor, where (0, 0) means directly ontop of the parent anchor. For example, You could attach the start position of a QCPItemLine to the bottom anchor of a QCPItemText to make the starting point of the line always be centered under the text label, no matter where the text is moved to. For more advanced plots, it is possible to assign different parent anchors per X/Y coordinate of the position, see setParentAnchorX, setParentAnchorY. This way an item could follow another item in the X direction but stay at a fixed position in the Y direction. Or even follow item A in X, and item B in Y.

Note that every QCPItemPosition inherits from QCPItemAnchor and thus can itself be used as parent anchor for other positions.

To set the apparent pixel position on the QCustomPlot surface directly, use setPixelPosition. This works no matter what type this QCPItemPosition is or what parent-child situation it is in, as setPixelPosition transforms the coordinates appropriately, to make the position appear at the specified pixel values.

Definicja w linii 3443 pliku qcustomplot.h.

Dokumentacja składowych wyliczanych

◆ PositionType

Defines the ways an item position can be specified. Thus it defines what the numbers passed to setCoords actually mean.

Zobacz również
setType
Wartości wyliczeń
ptAbsolute 

Static positioning in pixels, starting from the top left corner of the viewport/widget.

ptViewportRatio 

Static positioning given by a fraction of the viewport size. For example, if you call setCoords(0, 0), the position will be at the top left corner of the viewport/widget. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and vertically at the top of the viewport/widget, etc.

ptAxisRectRatio 

Static positioning given by a fraction of the axis rect size (see setAxisRect). For example, if you call setCoords(0, 0), the position will be at the top left corner of the axis rect. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and vertically at the top of the axis rect, etc. You can also go beyond the axis rect by providing negative coordinates or coordinates larger than 1.

ptPlotCoords 

Dynamic positioning at a plot coordinate defined by two axes (see setAxes).

Definicja w linii 3453 pliku qcustomplot.h.

Dokumentacja konstruktora i destruktora

◆ QCPItemPosition()

QCPItemPosition::QCPItemPosition ( QCustomPlot parentPlot,
QCPAbstractItem parentItem,
const QString &  name 
)

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

Definicja w linii 11499 pliku qcustomplot.cpp.

◆ ~QCPItemPosition()

QCPItemPosition::~QCPItemPosition ( )
virtual

Definicja w linii 11510 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:

Dokumentacja funkcji składowych

◆ axisRect()

QCPAxisRect * QCPItemPosition::axisRect ( ) const

Definicja w linii 11533 pliku qcustomplot.cpp.

Oto graf wywoływań tej funkcji:

◆ coords()

QPointF QCPItemPosition::coords ( ) const
inline

Definicja w linii 3476 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ key()

double QCPItemPosition::key ( ) const
inline

Definicja w linii 3474 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ keyAxis()

QCPAxis* QCPItemPosition::keyAxis ( ) const
inline

Definicja w linii 3477 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ parentAnchor()

QCPItemAnchor * QCPItemPosition::parentAnchor ( ) const
inline

Returns the current parent anchor.

If different parent anchors were set for X and Y (setParentAnchorX, setParentAnchorY), this method returns the parent anchor of the Y coordinate. In that case rather use parentAnchorX() and parentAnchorY().

Zobacz również
setParentAnchor

Definicja w linii 3471 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ parentAnchorX()

QCPItemAnchor* QCPItemPosition::parentAnchorX ( ) const
inline

Definicja w linii 3472 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ parentAnchorY()

QCPItemAnchor* QCPItemPosition::parentAnchorY ( ) const
inline

Definicja w linii 3473 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ pixelPosition()

QPointF QCPItemPosition::pixelPosition ( ) const
virtual

Returns the final absolute pixel position of the QCPItemPosition on the QCustomPlot surface. It includes all effects of type (setType) and possible parent anchors (setParentAnchor).

Zobacz również
setPixelPosition

Reimplementowana z QCPItemAnchor.

Definicja w linii 11823 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setAxes()

void QCPItemPosition::setAxes ( QCPAxis keyAxis,
QCPAxis valueAxis 
)

When setType is ptPlotCoords, this function may be used to specify the axes the coordinates set with setCoords relate to. By default they are set to the initial xAxis and yAxis of the QCustomPlot.

Definicja w linii 11923 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setAxisRect()

void QCPItemPosition::setAxisRect ( QCPAxisRect axisRect)

When setType is ptAxisRectRatio, this function may be used to specify the axis rect the coordinates set with setCoords relate to. By default this is set to the main axis rect of the QCustomPlot.

Definicja w linii 11934 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setCoords() [1/2]

void QCPItemPosition::setCoords ( const QPointF &  pos)

To jest metoda przeciążona, udostępniona dla wygody. Różni się od powyższej metody tylko zestawem akceptowanych argumentów.

Sets the coordinates as a QPointF pos where pos.x has the meaning of key and pos.y the meaning of value of the setCoords(double key, double value) method.

Definicja w linii 11812 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:

◆ setCoords() [2/2]

void QCPItemPosition::setCoords ( double  key,
double  value 
)

Sets the coordinates of this QCPItemPosition. What the coordinates mean, is defined by the type (setType, setTypeX, setTypeY).

For example, if the type is ptAbsolute, key and value mean the x and y pixel position on the QCustomPlot surface. In that case the origin (0, 0) is in the top left corner of the QCustomPlot viewport. If the type is ptPlotCoords, key and value mean a point in the plot coordinate system defined by the axes set by setAxes. By default those are the QCustomPlot's xAxis and yAxis. See the documentation of setType for other available coordinate types and their meaning.

If different types were configured for X and Y (setTypeX, setTypeY), key and value must also be provided in the different coordinate systems. Here, the X type refers to key, and the Y type refers to value.

Zobacz również
setPixelPosition

Definicja w linii 11801 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setParentAnchor()

bool QCPItemPosition::setParentAnchor ( QCPItemAnchor parentAnchor,
bool  keepPixelPosition = false 
)

Sets the parent of this QCPItemPosition to parentAnchor. This means the position will now follow any position changes of the anchor. The local coordinate system of positions with a parent anchor always is absolute pixels, with (0, 0) being exactly on top of the parent anchor. (Hence the type shouldn't be set to ptPlotCoords for positions with parent anchors.)

if keepPixelPosition is true, the current pixel position of the QCPItemPosition is preserved during reparenting. If it's set to false, the coordinates are set to (0, 0), i.e. the position will be exactly on top of the parent anchor.

To remove this QCPItemPosition from any parent anchor, set parentAnchor to 0.

If the QCPItemPosition previously had no parent and the type is ptPlotCoords, the type is set to ptAbsolute, to keep the position in a valid state.

This method sets the parent anchor for both X and Y directions. It is also possible to set different parents for X and Y, see setParentAnchorX, setParentAnchorY.

Definicja w linii 11647 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:

◆ setParentAnchorX()

bool QCPItemPosition::setParentAnchorX ( QCPItemAnchor parentAnchor,
bool  keepPixelPosition = false 
)

This method sets the parent anchor of the X coordinate to parentAnchor.

For a detailed description of what a parent anchor is, see the documentation of setParentAnchor.

Zobacz również
setParentAnchor, setParentAnchorY

Definicja w linii 11661 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setParentAnchorY()

bool QCPItemPosition::setParentAnchorY ( QCPItemAnchor parentAnchor,
bool  keepPixelPosition = false 
)

This method sets the parent anchor of the Y coordinate to parentAnchor.

For a detailed description of what a parent anchor is, see the documentation of setParentAnchor.

Zobacz również
setParentAnchor, setParentAnchorX

Definicja w linii 11726 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setPixelPosition()

void QCPItemPosition::setPixelPosition ( const QPointF &  pixelPosition)

Sets the apparent pixel position. This works no matter what type (setType) this QCPItemPosition is or what parent-child situation it is in, as coordinates are transformed appropriately, to make the position finally appear at the specified pixel values.

Only if the type is ptAbsolute and no parent anchor is set, this function's effect is identical to that of setCoords.

Zobacz również
pixelPosition, setCoords

Definicja w linii 11949 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setType()

void QCPItemPosition::setType ( QCPItemPosition::PositionType  type)

Sets the type of the position. The type defines how the coordinates passed to setCoords should be handled and how the QCPItemPosition should behave in the plot.

The possible values for type can be separated in two main categories:

  • The position is regarded as a point in plot coordinates. This corresponds to ptPlotCoords and requires two axes that define the plot coordinate system. They can be specified with setAxes. By default, the QCustomPlot's x- and yAxis are used.

Note that the position type ptPlotCoords is only available (and sensible) when the position has no parent anchor (setParentAnchor).

If the type is changed, the apparent pixel position on the plot is preserved. This means the coordinates as retrieved with coords() and set with setCoords may change in the process.

This method sets the type for both X and Y directions. It is also possible to set different types for X and Y, see setTypeX, setTypeY.

Definicja w linii 11563 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setTypeX()

void QCPItemPosition::setTypeX ( QCPItemPosition::PositionType  type)

This method sets the position type of the X coordinate to type.

For a detailed description of what a position type is, see the documentation of setType.

Zobacz również
setType, setTypeY

Definicja w linii 11576 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ setTypeY()

void QCPItemPosition::setTypeY ( QCPItemPosition::PositionType  type)

This method sets the position type of the Y coordinate to type.

For a detailed description of what a position type is, see the documentation of setType.

Zobacz również
setType, setTypeX

Definicja w linii 11606 pliku qcustomplot.cpp.

Oto graf wywołań dla tej funkcji:
Oto graf wywoływań tej funkcji:

◆ toQCPItemPosition()

virtual QCPItemPosition* QCPItemPosition::toQCPItemPosition ( )
inlineprotectedvirtual

Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if it actually is a QCPItemPosition (which is a subclass of QCPItemAnchor).

This safe downcast functionality could also be achieved with a dynamic_cast. However, QCustomPlot avoids dynamic_cast to work with projects that don't have RTTI support enabled (e.g. -fno-rtti flag with gcc compiler).

Reimplementowana z QCPItemAnchor.

Definicja w linii 3504 pliku qcustomplot.h.

◆ type()

QCPItemPosition::PositionType * QCPItemPosition::type ( ) const
inline

Returns the current position type.

If different types were set for X and Y (setTypeX, setTypeY), this method returns the type of the X coordinate. In that case rather use typeX() and typeY().

Zobacz również
setType

Definicja w linii 3468 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ typeX()

PositionType QCPItemPosition::typeX ( ) const
inline

Definicja w linii 3469 pliku qcustomplot.h.

◆ typeY()

PositionType QCPItemPosition::typeY ( ) const
inline

Definicja w linii 3470 pliku qcustomplot.h.

◆ value()

double QCPItemPosition::value ( ) const
inline

Definicja w linii 3475 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

◆ valueAxis()

QCPAxis* QCPItemPosition::valueAxis ( ) const
inline

Definicja w linii 3478 pliku qcustomplot.h.

Oto graf wywoływań tej funkcji:

Dokumentacja atrybutów składowych

◆ mAxisRect

QPointer<QCPAxisRect> QCPItemPosition::mAxisRect
protected

Definicja w linii 3499 pliku qcustomplot.h.

◆ mKey

double QCPItemPosition::mKey
protected

Definicja w linii 3500 pliku qcustomplot.h.

◆ mKeyAxis

QPointer<QCPAxis> QCPItemPosition::mKeyAxis
protected

Definicja w linii 3498 pliku qcustomplot.h.

◆ mParentAnchorX

QCPItemAnchor* QCPItemPosition::mParentAnchorX
protected

Definicja w linii 3501 pliku qcustomplot.h.

◆ mParentAnchorY

QCPItemAnchor * QCPItemPosition::mParentAnchorY
protected

Definicja w linii 3501 pliku qcustomplot.h.

◆ mPositionTypeX

PositionType QCPItemPosition::mPositionTypeX
protected

Definicja w linii 3497 pliku qcustomplot.h.

◆ mPositionTypeY

PositionType QCPItemPosition::mPositionTypeY
protected

Definicja w linii 3497 pliku qcustomplot.h.

◆ mValue

double QCPItemPosition::mValue
protected

Definicja w linii 3500 pliku qcustomplot.h.

◆ mValueAxis

QPointer<QCPAxis> QCPItemPosition::mValueAxis
protected

Definicja w linii 3498 pliku qcustomplot.h.


Dokumentacja dla tej klasy została wygenerowana z plików: