##// END OF EJS Templates
Introducing vertical and horizontal factors to control the position of the pie.
Introducing vertical and horizontal factors to control the position of the pie.

File last commit:

r454:06980850b7dd
r454:06980850b7dd
Show More
qpieslice.h
91 lines | 2.1 KiB | text/x-c | CLexer
#ifndef QPIESLICE_H
#define QPIESLICE_H
#include <qchartglobal.h>
#include <QObject>
#include <QPen>
#include <QBrush>
#include <QFont>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject
{
Q_OBJECT
Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY changed)
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed)
public:
QPieSlice(QObject *parent = 0);
QPieSlice(qreal value, QString label, QObject *parent = 0);
virtual ~QPieSlice();
// data
void setValue(qreal value);
qreal value() const;
void setLabel(QString label);
QString label() const;
void setLabelVisible(bool visible);
bool isLabelVisible() const;
void setExploded(bool exploded);
bool isExploded() const;
void setExplodeDistanceFactor(qreal factor);
qreal explodeDistanceFactor() const;
// generated data
qreal percentage() const;
qreal startAngle() const;
qreal endAngle() const;
// customization
void setPen(QPen pen);
QPen pen() const;
void setBrush(QBrush brush);
QBrush brush() const;
void setLabelPen(QPen pen);
QPen labelPen() const;
void setLabelFont(QFont font);
QFont labelFont() const;
void setLabelArmLengthFactor(qreal factor);
qreal labelArmLengthFactor() const;
// TODO: label position in general
// setLabelFlags(inside|outside|labelArmOn|labelArmOff|???)
// setLabelOrientation(horizontal|vertical|same as slice center angle|???)
Q_SIGNALS:
void clicked();
void hoverEnter();
void hoverLeave();
void changed();
private:
// TODO: use private class
friend class QPieSeries;
friend class PiePresenter;
friend class PieSlice;
// data
qreal m_value;
QString m_label;
bool m_isLabelVisible;
bool m_isExploded;
qreal m_explodeDistanceFactor;
// generated data
qreal m_percentage;
qreal m_startAngle;
qreal m_angleSpan;
// customization
QPen m_pen;
QBrush m_brush;
QPen m_labelPen;
QFont m_labelFont;
qreal m_labelArmLengthFactor;
};
QTCOMMERCIALCHART_END_NAMESPACE
#endif // QPIESLICE_H