qpieseries.h
100 lines
| 2.8 KiB
| text/x-c
|
CLexer
|
r794 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** All rights reserved. | ||||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
|
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 | ||||
|
r796 | void append(QPieSlice* slice); | ||
void append(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); | ||||
|
r796 | QPieSlice* append(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: | ||
|
r707 | void clicked(QPieSlice* slice, Qt::MouseButtons buttons); | ||
|
r203 | 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 | ||||