33 #include <KDABLibFakes> 37 class RelativePosition::Private {
38 friend class ::KDChart::RelativePosition;
54 RelativePosition::Private::Private()
62 RelativePosition::Private::~Private()
74 : _d( new Private( *r._d ) )
124 d->alignment = align;
132 d->horizontalPadding = pad;
136 return d->horizontalPadding;
140 d->verticalPadding = pad;
144 return d->verticalPadding;
158 bool useRect = (
d->area != 0 );
161 if (
const QWidget* widget = qobject_cast< const QWidget* >(
d->area ) ) {
162 const QLayout* layout = widget->layout();
163 rect = layout ? layout->geometry() : widget->geometry();
164 }
else if (
const AbstractArea* kdcArea = qobject_cast< const AbstractArea* >(
d->area ) ) {
165 rect = kdcArea->geometry();
176 pt =
d->points.point(
d->position );
177 angle =
d->points.degrees(
d->position.value() );
180 if ( polarDegrees ) {
181 *polarDegrees = angle;
194 if ( polarDegrees == 0.0 ) {
195 pt += QPointF( dx, dy );
197 const qreal rad = DEGTORAD( polarDegrees);
198 const qreal sinDeg = sin(rad);
199 const qreal cosDeg = cos(rad);
200 pt.setX( pt.x() + dx * cosDeg + dy * sinDeg );
201 pt.setY( pt.y() - dx * sinDeg + dy * cosDeg );
220 #if !defined(QT_NO_DEBUG_STREAM) 223 dbg <<
"KDChart::RelativePosition(" void setVerticalPadding(const Measure &padding)
Set the height of the vertical padding between the anchor point and the content placed by this Relati...
An area in the chart with a background, a frame, etc.
qreal calculatedValue(const QObject *autoArea, KDChartEnums::MeasureOrientation autoOrientation) const
The reference area must either be derived from AbstractArea or from QWidget, so it can also be derive...
Definition of global enums.
void setReferencePosition(Position position)
Set the position of the anchor point.
void setHorizontalPadding(const Measure &padding)
Set the width of the horizontal padding between the anchor point and the content placed by this Relat...
static const Position & Unknown
void setRotation(qreal rot)
RelativePosition & operator=(const RelativePosition &other)
Position referencePosition() const
void setAlignment(Qt::Alignment flags)
Set the alignment of the content placed by this RelativePosition.
const QPointF referencePoint(qreal *polarDegrees=0) const
Return the reference point, according to the reference area/position, and ignoring padding...
Measure verticalPadding() const
Declaring the class KDChart::Measure.
const QPointF point(Position position) const
void resetReferencePosition()
Resets the position of the anchor point to the built-in default.
QObject * referenceArea() const
Stores the absolute target points of a Position.
Measure horizontalPadding() const
const QPointF calculatedPoint(const QSizeF &autoSize) const
Calculate a point, accordin to the reference area/position and the padding.
const PositionPoints referencePoints() const
bool operator==(const RelativePosition &) const
Qt::Alignment alignment() const
Measure is used to specify relative and absolute sizes in KDChart, e.g.
Defines relative position information: reference area, position in this area (reference position)...
Class only listed here to document inheritance of some KDChart classes.
Defines a position, using compass terminology.
QDebug operator<<(QDebug stream, const DataDimension &r)
void setReferenceArea(QObject *area)
Set the reference area to be used to find the anchor point.
void setReferencePoints(const PositionPoints &points)
Set a set of points from which the anchor point will be selected.