 |
KD Chart 2
[rev.2.8]
|
Go to the documentation of this file.
33 #include <KDABLibFakes>
37 class RelativePosition::Private {
38 friend class ::KDChart::RelativePosition;
54 RelativePosition::Private::Private()
56 alignment( Qt::AlignCenter ),
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 resetReferencePosition()
Resets the position of the anchor point to the built-in default.
Defines a position, using compass terminology.
Stores the absolute target points of a Position.
void setAlignment(Qt::Alignment flags)
Set the alignment of the content placed by this RelativePosition.
@ MeasureOrientationVertical
Position referencePosition() const
const PositionPoints referencePoints() const
QDebug operator<<(QDebug stream, const DataDimension &r)
@ MeasureOrientationHorizontal
Measure is used to specify relative and absolute sizes in KDChart, e.g.
QObject * referenceArea() const
Definition of global enums.
Defines relative position information: reference area, position in this area (reference position),...
static const Position & Unknown
const QPointF calculatedPoint(const QSizeF &autoSize) const
Calculate a point, accordin to the reference area/position and the padding.
void setHorizontalPadding(const Measure &padding)
Set the width of the horizontal padding between the anchor point and the content placed by this Relat...
void setReferenceArea(QObject *area)
Set the reference area to be used to find the anchor point.
void setVerticalPadding(const Measure &padding)
Set the height of the vertical padding between the anchor point and the content placed by this Relati...
Measure verticalPadding() const
void setReferencePoints(const PositionPoints &points)
Set a set of points from which the anchor point will be selected.
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...
An area in the chart with a background, a frame, etc.
const QPointF referencePoint(qreal *polarDegrees=0) const
Return the reference point, according to the reference area/position, and ignoring padding.
QPointF point(Position position) const
bool operator==(const RelativePosition &) const
Declaring the class KDChart::Measure.
Measure horizontalPadding() const
void setReferencePosition(Position position)
Set the position of the anchor point.
void setRotation(qreal rot)
RelativePosition & operator=(const RelativePosition &other)
Qt::Alignment alignment() const