 |
KD Chart 2
[rev.2.8]
|
Go to the documentation of this file.
51 m_fifty->
setText( QObject::tr(
"50%" ) );
58 delete m_label; m_label = 0;
59 delete m_fifty; m_fifty = 0;
74 QPainter* p = paintContext->
painter();
82 labels << m_label << m_fifty;
84 const QPixmap& pixmap = label->
pixmap();
87 p->drawPixmap( point, pixmap );
110 return QSize( 100, 100 );
115 return QSize( 300, 200 );
120 return QSize( 150, 100 );
125 return Qt::Vertical | Qt::Horizontal;
141 qDebug() <<
"TernaryAxis::setPosition: only south, east and west are supported "
142 "positions for ternary axes.";
146 if ( m_title.isEmpty() )
147 switch ( p.
value() ) {
162 updatePrerenderedLabels();
173 return m_label->
text();
178 m_titleAttributes = a;
179 updatePrerenderedLabels();
184 return m_titleAttributes;
190 m_titleAttributes = a;
191 updatePrerenderedLabels();
197 return m_titleAttributes == a;
200 void TernaryAxis::updatePrerenderedLabels()
203 qreal axisLabelAngle = 0.0;
204 qreal fiftyMarkAngle = 0.0;
205 QPointF axisLabelPosition;
206 QPointF fiftyMarkPosition;
212 axisLabelAngle = 0.0;
213 fiftyMarkAngle = 0.0;
220 axisLabelAngle = 240.0;
228 axisLabelAngle = 120.0;
229 fiftyMarkAngle = 300.0;
237 qDebug() <<
"TernaryAxis::updatePrerenderedLabel: unknown location";
242 m_label->
setAngle( axisLabelAngle );
245 QFont font = attributes.
font();
246 font.setPointSizeF( 0.85 * font.pointSizeF() );
248 m_fifty->
setAngle( fiftyMarkAngle );
255 QSizeF topleft( 0.0, 0.0 );
256 QSizeF bottomRight( 0.0, 0.0 );
261 topleft.setHeight( m_label->
pixmap().height() );
262 bottomRight.setHeight( m_fifty->
pixmap().height() );
265 bottomRight.setWidth( m_label->
pixmap().width()
267 bottomRight.setHeight( m_label->
pixmap().height()
271 topleft.setWidth( m_label->
pixmap().width()
272 - ( m_label->
pixmap().width()
274 bottomRight.setHeight( m_label->
pixmap().height()
275 - ( m_label->
pixmap().height()
279 qDebug() <<
"TernaryAxis::requiredMargins: unknown location";
PositionValue
Numerical values of the static KDChart::Position instances, for using a Position::value() with a swit...
void resetTitleTextAttributes()
Defines a position, using compass terminology.
const QPointF TriangleBottomLeft
void paintCtx(PaintContext *) override
Default impl: Paint the complete item using its layouted position and size.
TernaryAxis(AbstractTernaryDiagram *diagram=0)
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
const QPointF TriangleTop
const QString & text() const
QSize sizeHint() const override
void setTitleText(const QString &text)
void setAngle(qreal angle)
Sets the angle of the label to angle degrees.
AbstractCoordinatePlane * coordinatePlane() const
QPointF referencePointLocation(KDChartEnums::PositionValue position) const override
Return the location of the reference point relatively to the pixmap's origin.
void setGeometry(const QRect &rect) override
const QPointF TriangleBottomRight
KDChartEnums::PositionValue value() const
Returns an integer value corresponding to this Position.
Stores information about painting diagrams.
virtual const Position position() const
A set of text attributes.
QPair< QSizeF, QSizeF > requiredMargins() const
PrerenderedLabel is an internal KDChart class that simplifies creation and caching of cached text lab...
bool hasDefaultTitleTextAttributes() const
const qreal RelMarkerLength
QPainter * painter() const
QSize maximumSize() const override
QStringList labels() const
Returns a list of strings, that are used as axis labels, as set via setLabels.
void setReferencePoint(KDChartEnums::PositionValue)
Set the reference point of the element.
QRect geometry() const override
Base class for diagrams based on a ternary coordinate plane.
Qt::Orientations expandingDirections() const override
void paint(QPainter *) override
const QPointF & position() const
Get the position of the element.
bool isEmpty() const override
virtual void setPosition(Position p)
void setTitleTextAttributes(const TextAttributes &a)
const QPointF AxisVector_B_A
QSize minimumSize() const override
void setText(const QString &text)
Sets the label's text to text.
const AbstractDiagram * diagram() const
const QPointF translate(const QPointF &diagramPoint) const override
Translate the given point in value space coordinates to a position in pixel space.
const QPointF AxisVector_C_A
QString titleText() const
void setPosition(const QPointF &position)
Set the position of the element.
void paintAll(QPainter &) override
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invo...
void setFont(const QFont &font)
Sets the label's font to font.
const QPointF AxisVector_B_C
Ternary coordinate plane.
TextAttributes titleTextAttributes() const
const QPixmap & pixmap() const override
Returns the rendered element.