qpieseries.h
61 lines
| 1.4 KiB
| text/x-c
|
CLexer
/ src / qpieseries.h
|
r51 | #ifndef PIESERIES_H | ||
#define PIESERIES_H | ||||
#include "qchartseries.h" | ||||
#include <QObject> | ||||
#include <QRectF> | ||||
#include <QColor> | ||||
class QGraphicsObject; | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class PieSlice; | ||||
class QTCOMMERCIALCHART_EXPORT QPieSeries : public QChartSeries | ||||
{ | ||||
Q_OBJECT | ||||
|
r60 | |||
|
r77 | public: | ||
enum PiePosition { | ||||
PiePositionMaximized = 0, | ||||
PiePositionTopLeft, | ||||
PiePositionTopRight, | ||||
PiePositionBottomLeft, | ||||
PiePositionBottomRight | ||||
}; | ||||
|
r51 | public: | ||
// TODO: use a generic data class instead of x and y | ||||
|
r61 | QPieSeries(QGraphicsObject *parent = 0); | ||
|
r51 | ~QPieSeries(); | ||
public: // from QChartSeries | ||||
QChartSeriesType type() const { return QChartSeries::SeriesTypePie; } | ||||
|
r61 | bool setData(QList<qreal> data); | ||
|
r51 | |||
|
r75 | public: | ||
void setSliceColor(int index, QColor color); | ||||
QColor sliceColor(int index); | ||||
int sliceCount(); | ||||
|
r77 | void setSizeFactor(qreal sizeFactor); | ||
qreal sizeFactor() { return m_sizeFactor; } | ||||
void setPosition(PiePosition position); | ||||
|
r75 | |||
|
r51 | public Q_SLOTS: | ||
|
r54 | void chartSizeChanged(QRectF rect); | ||
|
r51 | |||
private: | ||||
|
r60 | void resizeSlices(QRectF rect); | ||
|
r51 | //Q_DECLARE_PRIVATE(QPieSeries) | ||
Q_DISABLE_COPY(QPieSeries) | ||||
|
r75 | friend class QChart; | ||
|
r51 | // TODO: move the followin to internal impl | ||
|
r61 | QList<qreal> m_data; | ||
|
r51 | QList<PieSlice*> m_slices; | ||
|
r60 | QRectF m_chartSize; | ||
qreal m_sizeFactor; | ||||
|
r77 | PiePosition m_position; | ||
|
r51 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // PIESERIES_H | ||||