KD Chart 2
[rev.2.7]
|
Defines relative position information: reference area, position in this area (reference position), horizontal / vertical padding, and rotation. More...
#include <KDChartRelativePosition.h>
Public Member Functions | |
Qt::Alignment | alignment () const |
const QPointF | calculatedPoint (const QSizeF &autoSize) const |
Calculate a point, accordin to the reference area/position and the padding. More... | |
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 (qreal *polarDegrees=0) const |
Return the reference point, according to the reference area/position, and ignoring padding. More... | |
const PositionPoints | referencePoints () const |
Position | referencePosition () const |
RelativePosition () | |
RelativePosition (const RelativePosition &) | |
void | resetReferencePosition () |
Resets the position of the anchor point to the built-in default. More... | |
qreal | rotation () const |
void | setAlignment (Qt::Alignment flags) |
Set the alignment of the content placed by this RelativePosition. More... | |
void | setHorizontalPadding (const Measure &padding) |
Set the width of the horizontal padding between the anchor point and the content placed by this RelativePosition. More... | |
void | setReferenceArea (QObject *area) |
Set the reference area to be used to find the anchor point. More... | |
void | setReferencePoints (const PositionPoints &points) |
Set a set of points from which the anchor point will be selected. More... | |
void | setReferencePosition (Position position) |
Set the position of the anchor point. More... | |
void | setRotation (qreal rot) |
void | setVerticalPadding (const Measure &padding) |
Set the height of the vertical padding between the anchor point and the content placed by this RelativePosition. More... | |
Measure | verticalPadding () const |
~RelativePosition () | |
Defines relative position information: reference area, position in this area (reference position), horizontal / vertical padding, and rotation.
See detailed description of KDChart::Position for an illustration of the different possible reference positions.
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.
Definition at line 57 of file KDChartRelativePosition.h.
RelativePosition::RelativePosition | ( | ) |
Definition at line 67 of file KDChartRelativePosition.cpp.
RelativePosition::RelativePosition | ( | const RelativePosition & | r | ) |
Definition at line 73 of file KDChartRelativePosition.cpp.
RelativePosition::~RelativePosition | ( | ) |
Definition at line 85 of file KDChartRelativePosition.cpp.
Qt::Alignment RelativePosition::alignment | ( | ) | const |
Definition at line 127 of file KDChartRelativePosition.cpp.
References d.
Referenced by operator<<(), and operator==().
const QPointF RelativePosition::calculatedPoint | ( | const QSizeF & | autoSize | ) | const |
Calculate a point, accordin to the reference area/position and the padding.
This method is called at drawing time: The returned point is used as anchor point. Note that it is the task of the calling code to place the content, taking the alignment property into account. This class does not know the size of the content so it cannot place it.
Definition at line 187 of file KDChartRelativePosition.cpp.
References KDChart::Measure::calculatedValue(), horizontalPadding(), KDChartEnums::MeasureOrientationHorizontal, KDChartEnums::MeasureOrientationVertical, referencePoint(), and verticalPadding().
Measure RelativePosition::horizontalPadding | ( | ) | const |
Definition at line 135 of file KDChartRelativePosition.cpp.
References d.
Referenced by calculatedPoint(), operator<<(), and operator==().
bool KDChart::RelativePosition::operator!= | ( | const RelativePosition & | other | ) | const |
Definition at line 207 of file KDChartRelativePosition.h.
References KDCHART_DECLARE_SWAP_SPECIALISATION, KDChart::operator<<(), KDGantt::operator==(), and Q_DECLARE_TYPEINFO().
RelativePosition & RelativePosition::operator= | ( | const RelativePosition & | other | ) |
Definition at line 79 of file KDChartRelativePosition.cpp.
bool RelativePosition::operator== | ( | const RelativePosition & | r | ) | const |
Definition at line 207 of file KDChartRelativePosition.cpp.
References alignment(), d, horizontalPadding(), referenceArea(), referencePosition(), rotation(), and verticalPadding().
QObject * RelativePosition::referenceArea | ( | ) | const |
Definition at line 98 of file KDChartRelativePosition.cpp.
References d.
Referenced by operator<<(), and operator==().
const QPointF RelativePosition::referencePoint | ( | qreal * | polarDegrees = 0 | ) | const |
Return the reference point, according to the reference area/position, and ignoring 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: a label is printed only if its reference point is inside or touching the coordinate plane.
If polarDegrees is set, the degree information will be returned that was stored for the respective point. This is used by the PieDiagram class to determine how vertical/horizontal padding settings should affect the position of the data value texts' reference points.
Definition at line 156 of file KDChartRelativePosition.cpp.
References d, and KDChart::PositionPoints::point().
Referenced by calculatedPoint().
const PositionPoints RelativePosition::referencePoints | ( | ) | const |
Definition at line 107 of file KDChartRelativePosition.cpp.
References d.
Position RelativePosition::referencePosition | ( | ) | const |
Definition at line 119 of file KDChartRelativePosition.cpp.
References d.
Referenced by operator<<(), and operator==().
void 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) KD Chart will choose an appropriate Position at run-time.
e.g. BarDiagrams will use Position::North / Position::South for positive / negative values.
Definition at line 115 of file KDChartRelativePosition.cpp.
References d, and KDChart::Position::Unknown.
qreal RelativePosition::rotation | ( | ) | const |
Definition at line 151 of file KDChartRelativePosition.cpp.
References d.
Referenced by operator<<(), and operator==().
void RelativePosition::setAlignment | ( | Qt::Alignment | flags | ) |
Set the alignment of the content placed by this RelativePosition.
Padding is applied first to obtain the final reference point for the content's alignment
Definition at line 123 of file KDChartRelativePosition.cpp.
References d.
void RelativePosition::setHorizontalPadding | ( | const Measure & | padding | ) |
Set the width of the horizontal padding between the anchor point and the content placed by this RelativePosition.
Definition at line 131 of file KDChartRelativePosition.cpp.
References d.
void RelativePosition::setReferenceArea | ( | QObject * | area | ) |
Set the reference area to be used to find the anchor point.
The reference area's type can be either a QWidget subclass or a KDChart::AbstractArea subclass.
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 always taken to be the data area.
Definition at line 92 of file KDChartRelativePosition.cpp.
References d, and setReferencePoints().
Referenced by setReferencePoints().
void RelativePosition::setReferencePoints | ( | const PositionPoints & | points | ) |
Set a set of points from which the anchor point will be selected.
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 always taken to be the data area.
Definition at line 102 of file KDChartRelativePosition.cpp.
References d, KDChart::PositionPoints::isNull(), and setReferenceArea().
Referenced by setReferenceArea().
void RelativePosition::setReferencePosition | ( | Position | position | ) |
Set 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 detailed description of KDChart::Position for an illustration of the different possible reference positions.
Definition at line 111 of file KDChartRelativePosition.cpp.
References d.
void RelativePosition::setRotation | ( | qreal | rot | ) |
Definition at line 147 of file KDChartRelativePosition.cpp.
References d.
void RelativePosition::setVerticalPadding | ( | const Measure & | padding | ) |
Set the height of the vertical padding between the anchor point and the content placed by this RelativePosition.
Definition at line 139 of file KDChartRelativePosition.cpp.
References d.
Measure RelativePosition::verticalPadding | ( | ) | const |
Definition at line 143 of file KDChartRelativePosition.cpp.
References d.
Referenced by calculatedPoint(), operator<<(), and operator==().