KD Chart 2: KDChart::RelativePosition class Reference

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# KDChart::RelativePosition Class Reference

`#include <KDChartRelativePosition.h>`

List of all members.

## Detailed Description

Defines relative position information: reference area, position in this area, horizontal / vertical padding, and rotating.

Using RelativePosition you can specify the relative parts of some position information, and you can specify the absolute parts: the reference area, and the position in this area.

To get an absolute position, you have three options:

- either you declare both, the relative and the absolute parts, using setReferenceArea for the later,
- or you specify a set of points, using setReferencePoints,
- or you refrein from using either, but leave it to KD Chart to find a matching reference area for you.

Definition at line 62 of file KDChartRelativePosition.h.

## Public Member Functions
Qt::Alignment | alignment () const
const QPointF | calculatedPoint (const QSizeF &autoSize) const
| Calculate a point, according to the reference area/position and horiz/vert padding.
Measure | horizontalPadding () const
bool | operator!= (const RelativePosition &other) const
RelativePosition & | operator= (const RelativePosition &other)
bool | operator== (const RelativePosition &) const
QObject * | referenceArea () const
const QPointF | referencePoint () const
| Return the reference point, according to the reference area/position, but ignoring horiz/vert padding.
const PositionPoints | referencePoints () const
Position | referencePosition () const
| RelativePosition (const RelativePosition &)
| RelativePosition ()
void | resetReferencePosition ()
| Resets the position of the anchor point to the built-in default.
qreal | rotation () const
void | setAlignment (Qt::Alignment flags)
| Specifies the location of the content, that is to be positioned by this RelativePosition.
void | setHorizontalPadding (const Measure &padding)
| Specifies the horizontal width of the gap between the anchor point and the content, that is to be positioned by this RelativePosition.
void | setReferenceArea (QObject *area)
| Specifies the reference area to be used to find the anchor point.
void | setReferencePoints (const PositionPoints &points)
| Specifies a set of points from which the anchor point will be selected.
void | setReferencePosition (Position position)
| Specifies the position of the anchor point.
void | setRotation (qreal rot)
void | setVerticalPadding (const Measure &padding)
| Specifies the vertical width of the gap between the anchor point and the content, that is to be positioned by this RelativePosition.
Measure | verticalPadding () const
| ~RelativePosition ()

## Constructor & Destructor Documentation

KDChart::RelativePosition::RelativePosition | ( |  | ) |

KDChart::RelativePosition::RelativePosition | ( | const RelativePosition & |  | ) |

KDChart::RelativePosition::~RelativePosition | ( |  | ) |

## Member Function Documentation

Qt::Alignment KDChart::RelativePosition::alignment | ( |  | ) | const

| Referenced by operator<<(), KDChart::AbstractDiagram::paintDataValueText(), and KDChart::Chart::reLayoutFloatingLegends().

const QPointF KDChart::RelativePosition::calculatedPoint | ( | const QSizeF & | autoSize | ) | const

| Calculate a point, according to the reference area/position and horiz/vert padding. This method is called at drawing time: The returned point is used as anchor point. Note that calculatedPoint ignores the alignment setting, it just returns the point, so the calling code needs to take alignment into account explicitely. See also: referencePoint, setReferenceArea, setReferencePosition, setHorizontalPadding, setVerticalPadding Referenced by KDChart::Chart::reLayoutFloatingLegends().

Measure KDChart::RelativePosition::horizontalPadding | ( |  | ) | const

| Referenced by operator<<().

bool KDChart::RelativePosition::operator!= | ( | const RelativePosition & | other | ) | const

| Definition at line 198 of file KDChartRelativePosition.h. References operator==().
    00198 { return !operator==( other ); }

RelativePosition& KDChart::RelativePosition::operator= | ( | const RelativePosition & | other | ) |

bool KDChart::RelativePosition::operator== | ( | const RelativePosition & |  | ) | const

| Referenced by operator!=().

QObject* KDChart::RelativePosition::referenceArea | ( |  | ) | const

| Referenced by operator<<().

const QPointF KDChart::RelativePosition::referencePoint | ( |  | ) | const

| Return the reference point, according to the reference area/position, but ignoring horiz/vert padding. This method is called at drawing time. The returned point is used to test if the label of a data value is to be printed: labels are printed only, if their reference points are either inside or touching the coordinate plane. See also: calculatedPoint, setReferenceArea, setReferencePosition, setHorizontalPadding, setVerticalPadding

const PositionPoints KDChart::RelativePosition::referencePoints | ( |  | ) | const

Position KDChart::RelativePosition::referencePosition | ( |  | ) | const

| Referenced by operator<<().

void KDChart::RelativePosition::resetReferencePosition | ( |  | ) |

| Resets the position of the anchor point to the built-in default. If the anchor point of a RelativePosition is reset (or never changed from the default setting, resp.) KD Chart will choose an appropriate Position at run-time. e.g. BarDiagrams will use Position::NorthWest / Position::SouthEast for positive / negative values. See also: setReferencePosition, setReferenceArea, setAlignment, setHorizontalPadding, setVerticalPadding, KDChart::Position

qreal KDChart::RelativePosition::rotation | ( |  | ) | const

| Referenced by operator<<().

void KDChart::RelativePosition::setAlignment | ( | Qt::Alignment | flags | ) |

| Specifies the location of the content, that is to be positioned by this RelativePosition. Aligning is applied, after horiz./vert. padding was retrieved to calculate the real reference point, so aligning is seen as relative to that point. See also: setReferencePosition, setReferenceArea, setHorizontalPadding, setVerticalPadding

void KDChart::RelativePosition::setHorizontalPadding | ( | const Measure & | padding | ) |

| Specifies the horizontal width of the gap between the anchor point and the content, that is to be positioned by this RelativePosition. Note: When printing data value texts the font height is used as reference size for both, horizontal and vertical padding, if the respective padding's Measure is using automatic reference area detection. See also: setVerticalPadding, setReferencePosition, setReferenceArea

void KDChart::RelativePosition::setReferenceArea | ( | QObject * | area | ) |

| Specifies the reference area to be used to find the anchor point. The reference area's type can be either QWidget, or be derived from KDChart::AbstractArea. Note: Usage of reference area and reference points works mutually exclusively: Only one setting can be valid, so any former specification of reference points is reset when you call setReferenceArea. Also note: In a few cases KD Chart will ignore your area (or points, resp.) settings! Relative positioning of data value texts is an example: For these the reference area is the respective data area taking precendence over your settings. See also: setReferencePosition, setAlignment, setHorizontalPadding, setVerticalPadding

void KDChart::RelativePosition::setReferencePoints | ( | const PositionPoints & | points | ) |

| Specifies a set of points from which the anchor point will be selected. Note: Usage of reference area and reference points works mutually exclusively: Only one setting can be valid, so any former specification of reference area is reset when you call setReferencePoints. Also note: In a few cases KD Chart will ignore your points (or area, resp.) settings! Relative positioning of data value texts is an example: For these the reference area is the respective data area taking precendence over your settings. See also: setReferenceArea, setReferencePosition, setAlignment, setHorizontalPadding, setVerticalPadding

void KDChart::RelativePosition::setReferencePosition | ( | Position | position | ) |

| Specifies the position of the anchor point. The anchor point of a RelativePosition may be one of the pre-defined points of it's reference area - for details see KDChart::Position. See also: resetReferencePosition, setReferenceArea, setAlignment, setHorizontalPadding, setVerticalPadding, KDChart::Position

void KDChart::RelativePosition::setRotation | ( | qreal | rot | ) |

void KDChart::RelativePosition::setVerticalPadding | ( | const Measure & | padding | ) |

| Specifies the vertical width of the gap between the anchor point and the content, that is to be positioned by this RelativePosition. Note: When printing data value texts the font height is used as reference size for both, horizontal and vertical padding, if the respective padding's Measure is using automatic reference area detection. See also: setHorizontalPadding, setReferencePosition, setReferenceArea

Measure KDChart::RelativePosition::verticalPadding | ( |  | ) | const

| Referenced by operator<<().

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

- KDChartRelativePosition.h