qpieslice.h
91 lines
| 2.2 KiB
| text/x-c
|
CLexer
|
r203 | #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 | ||||
|
r314 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY changed) | ||
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) | ||||
|
r203 | |||
public: | ||||
QPieSlice(QObject *parent = 0); | ||||
|
r314 | QPieSlice(qreal value, QString label, QObject *parent = 0); | ||
|
r203 | virtual ~QPieSlice(); | ||
// data | ||||
|
r437 | void setValue(qreal value); | ||
|
r203 | qreal value() const; | ||
|
r437 | void setLabel(QString label); | ||
|
r203 | QString label() const; | ||
|
r437 | void setLabelVisible(bool visible); | ||
|
r203 | bool isLabelVisible() const; | ||
|
r437 | void setExploded(bool exploded); | ||
|
r203 | bool isExploded() const; | ||
|
r454 | void setExplodeDistanceFactor(qreal factor); | ||
qreal explodeDistanceFactor() const; | ||||
|
r203 | |||
// generated data | ||||
qreal percentage() const; | ||||
|
r355 | qreal startAngle() const; | ||
qreal endAngle() const; | ||||
|
r203 | |||
// customization | ||||
|
r469 | void setSlicePen(const QPen &pen); | ||
QPen slicePen() const; | ||||
void setSliceBrush(const QBrush &brush); | ||||
QBrush sliceBrush() const; | ||||
void setLabelArmPen(const QPen &pen); | ||||
QPen labelArmPen() const; | ||||
void setLabelFont(const QFont &font); | ||||
|
r203 | QFont labelFont() const; | ||
|
r454 | void setLabelArmLengthFactor(qreal factor); | ||
qreal labelArmLengthFactor() const; | ||||
|
r203 | |||
|
r437 | // TODO: label position in general | ||
// setLabelFlags(inside|outside|labelArmOn|labelArmOff|???) | ||||
// setLabelOrientation(horizontal|vertical|same as slice center angle|???) | ||||
|
r203 | Q_SIGNALS: | ||
void clicked(); | ||||
void hoverEnter(); | ||||
void hoverLeave(); | ||||
void changed(); | ||||
private: | ||||
// TODO: use private class | ||||
friend class QPieSeries; | ||||
|
r289 | friend class PiePresenter; | ||
|
r355 | friend class PieSlice; | ||
|
r203 | |||
// data | ||||
qreal m_value; | ||||
QString m_label; | ||||
bool m_isLabelVisible; | ||||
bool m_isExploded; | ||||
|
r454 | qreal m_explodeDistanceFactor; | ||
|
r203 | |||
// generated data | ||||
qreal m_percentage; | ||||
|
r355 | qreal m_startAngle; | ||
|
r289 | qreal m_angleSpan; | ||
|
r203 | |||
// customization | ||||
|
r469 | QPen m_slicePen; | ||
QBrush m_sliceBrush; | ||||
|
r203 | QFont m_labelFont; | ||
|
r469 | QPen m_labelArmPen; | ||
|
r454 | qreal m_labelArmLengthFactor; | ||
|
r203 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QPIESLICE_H | ||||