##// END OF EJS Templates
Pie now actually withs the given rectangle and does not go over
Pie now actually withs the given rectangle and does not go over

File last commit:

r353:e5ed5bdfafc1
r413:afa09ce7f031
Show More
pieslicelabel_p.h
57 lines | 1.4 KiB | text/x-c | CLexer
#ifndef PIELABEL_H
#define PIELABEL_H
#include "qchartglobal.h"
#include <QGraphicsItem>
#include <QPen>
#include <QFontMetricsF>
class QGraphicsTextItem;
QTCOMMERCIALCHART_BEGIN_NAMESPACE
class PieSliceLabel : public QGraphicsItem
{
public:
PieSliceLabel(QGraphicsItem* parent = 0);
~PieSliceLabel() {};
public: // from QGraphicsItem
QRectF boundingRect() const { return m_rect; }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
public:
void updateGeometry();
void setArmStartPoint(QPointF point) { m_armStartPoint = point; }
QPointF armStartPoint() const { return m_armStartPoint; }
void setArmAngle(qreal angle) { m_armAngle = angle; }
qreal armAngle() const { return m_armAngle; }
void setArmLength(qreal len) { m_armLength = len; }
qreal armLength() const { return m_armLength; }
void setText(QString text) { m_text = text; }
QString text() const { return m_text; }
void setPen(QPen pen) { m_pen = pen; }
QPen pen() const { return m_pen; }
void setFont(QFont font) { m_font = font; }
QFont font() const { return m_font; }
private:
QPointF m_armStartPoint;
qreal m_armAngle;
qreal m_armLength;
QString m_text;
QRectF m_rect;
QPainterPath m_armPath;
QRectF m_textRect;
QPen m_pen;
QFont m_font;
};
QTCOMMERCIALCHART_END_NAMESPACE
#endif // PIELABEL_H