qpieseries.h
80 lines
| 2.0 KiB
| text/x-c
|
CLexer
|
r142 | #ifndef PIESERIES_H | ||
#define PIESERIES_H | ||||
|
r669 | #include <qseries.h> | ||
|
r142 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r669 | class QPieSeriesPrivate; | ||
|
r203 | class QPieSlice; | ||
|
r157 | |||
|
r360 | class QTCOMMERCIALCHART_EXPORT QPieSeries : public QSeries | ||
|
r142 | { | ||
Q_OBJECT | ||||
public: | ||||
QPieSeries(QObject *parent = 0); | ||||
|
r203 | virtual ~QPieSeries(); | ||
|
r142 | |||
public: // from QChartSeries | ||||
|
r360 | QSeriesType type() const; | ||
|
r142 | |||
public: | ||||
|
r437 | |||
// slice setters | ||||
|
r203 | void add(QPieSlice* slice); | ||
|
r437 | void add(QList<QPieSlice*> slices); | ||
|
r604 | void insert(int i, QPieSlice* slice); | ||
|
r437 | void replace(QList<QPieSlice*> slices); | ||
|
r203 | void remove(QPieSlice* slice); | ||
void clear(); | ||||
|
r142 | |||
|
r669 | // slice getters | ||
|
r314 | QList<QPieSlice*> slices() const; | ||
|
r174 | |||
|
r437 | // calculated data | ||
int count() const; | ||||
|
r621 | bool isEmpty() const; | ||
|
r437 | qreal total() const; | ||
// pie customization | ||||
|
r498 | void setPiePosition(qreal relativeHorizontalPosition, qreal relativeVerticalPosition); | ||
qreal pieHorizontalPosition() const; | ||||
qreal pieVerticalPosition() const; | ||||
void setPieSize(qreal relativeSize); | ||||
qreal pieSize() const; | ||||
void setPieStartAngle(qreal startAngle); | ||||
qreal pieStartAngle() const; | ||||
void setPieEndAngle(qreal endAngle); | ||||
qreal pieEndAngle() const; | ||||
|
r203 | |||
|
r437 | // convenience function | ||
QPieSeries& operator << (QPieSlice* slice); | ||||
QPieSlice* add(qreal value, QString name); | ||||
|
r386 | void setLabelsVisible(bool visible = true); | ||
|
r203 | |||
|
r597 | // data from model | ||
bool setModel(QAbstractItemModel* model); | ||||
void setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation = Qt::Vertical); | ||||
|
r157 | Q_SIGNALS: | ||
|
r203 | void clicked(QPieSlice* slice); | ||
void hoverEnter(QPieSlice* slice); | ||||
void hoverLeave(QPieSlice* slice); | ||||
|
r621 | void added(QList<QPieSlice*> slices); | ||
void removed(QList<QPieSlice*> slices); | ||||
void piePositionChanged(); | ||||
void pieSizeChanged(); | ||||
|
r181 | |||
|
r174 | private: | ||
|
r669 | QPieSeriesPrivate * const d_ptr; | ||
Q_DECLARE_PRIVATE(QPieSeries) | ||||
Q_DISABLE_COPY(QPieSeries) | ||||
|
r676 | |||
public: | ||||
typedef QPieSeriesPrivate * const DataPtr; | ||||
inline DataPtr &data_ptr() { return d_ptr; } | ||||
|
r142 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // PIESERIES_H | ||||