qpieslice.h
91 lines
| 2.1 KiB
| text/x-c
|
CLexer
Jani Honkonen
|
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 | ||||
Jani Honkonen
|
r314 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY changed) | ||
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) | ||||
Jani Honkonen
|
r203 | |||
public: | ||||
QPieSlice(QObject *parent = 0); | ||||
Jani Honkonen
|
r314 | QPieSlice(qreal value, QString label, QObject *parent = 0); | ||
Jani Honkonen
|
r203 | virtual ~QPieSlice(); | ||
// data | ||||
Jani Honkonen
|
r437 | void setValue(qreal value); | ||
Jani Honkonen
|
r203 | qreal value() const; | ||
Jani Honkonen
|
r437 | void setLabel(QString label); | ||
Jani Honkonen
|
r203 | QString label() const; | ||
Jani Honkonen
|
r437 | void setLabelVisible(bool visible); | ||
Jani Honkonen
|
r203 | bool isLabelVisible() const; | ||
Jani Honkonen
|
r437 | void setExploded(bool exploded); | ||
Jani Honkonen
|
r203 | bool isExploded() const; | ||
Jani Honkonen
|
r437 | void setExplodeDistance(qreal distance); | ||
Jani Honkonen
|
r289 | qreal explodeDistance() const; | ||
Jani Honkonen
|
r203 | |||
// generated data | ||||
qreal percentage() const; | ||||
Jani Honkonen
|
r355 | qreal startAngle() const; | ||
qreal endAngle() const; | ||||
Jani Honkonen
|
r203 | |||
// customization | ||||
Jani Honkonen
|
r437 | void setPen(QPen pen); | ||
Jani Honkonen
|
r203 | QPen pen() const; | ||
Jani Honkonen
|
r437 | void setBrush(QBrush brush); | ||
Jani Honkonen
|
r203 | QBrush brush() const; | ||
Jani Honkonen
|
r437 | void setLabelPen(QPen pen); | ||
Jani Honkonen
|
r203 | QPen labelPen() const; | ||
Jani Honkonen
|
r437 | void setLabelFont(QFont font); | ||
Jani Honkonen
|
r203 | QFont labelFont() const; | ||
Jani Honkonen
|
r437 | void setLabelArmLength(qreal len); | ||
Jani Honkonen
|
r289 | qreal labelArmLength() const; | ||
Jani Honkonen
|
r203 | |||
Jani Honkonen
|
r437 | // TODO: label position in general | ||
// setLabelFlags(inside|outside|labelArmOn|labelArmOff|???) | ||||
// setLabelOrientation(horizontal|vertical|same as slice center angle|???) | ||||
Jani Honkonen
|
r203 | Q_SIGNALS: | ||
void clicked(); | ||||
void hoverEnter(); | ||||
void hoverLeave(); | ||||
void changed(); | ||||
private: | ||||
// TODO: use private class | ||||
friend class QPieSeries; | ||||
Jani Honkonen
|
r289 | friend class PiePresenter; | ||
Jani Honkonen
|
r355 | friend class PieSlice; | ||
Jani Honkonen
|
r203 | |||
// data | ||||
qreal m_value; | ||||
QString m_label; | ||||
bool m_isLabelVisible; | ||||
bool m_isExploded; | ||||
Jani Honkonen
|
r289 | qreal m_explodeDistance; | ||
Jani Honkonen
|
r203 | |||
// generated data | ||||
qreal m_percentage; | ||||
Jani Honkonen
|
r355 | qreal m_startAngle; | ||
Jani Honkonen
|
r289 | qreal m_angleSpan; | ||
Jani Honkonen
|
r203 | |||
// customization | ||||
QPen m_pen; | ||||
QBrush m_brush; | ||||
QPen m_labelPen; | ||||
QFont m_labelFont; | ||||
qreal m_labelArmLength; | ||||
}; | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QPIESLICE_H | ||||