piechartitem_p.h
59 lines
| 1.6 KiB
| text/x-c
|
CLexer
|
r568 | #ifndef PIECHARTITEM_H | ||
#define PIECHARTITEM_H | ||||
|
r142 | |||
#include "qpieseries.h" | ||||
|
r566 | #include "chartitem_p.h" | ||
|
r673 | #include "piesliceitem_p.h" | ||
|
r142 | |||
class QGraphicsItem; | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r566 | class QPieSlice; | ||
|
r659 | class ChartPresenter; | ||
|
r142 | |||
|
r668 | typedef QHash<QPieSlice*, PieSliceData> PieLayout; | ||
|
r629 | |||
|
r568 | class PieChartItem : public QObject, public ChartItem | ||
|
r142 | { | ||
Q_OBJECT | ||||
public: | ||||
// TODO: use a generic data class instead of x and y | ||||
|
r659 | PieChartItem(QPieSeries *series, ChartPresenter *presenter, QGraphicsItem *parent); | ||
|
r568 | ~PieChartItem(); | ||
|
r142 | |||
|
r157 | public: // from QGraphicsItem | ||
|
r142 | QRectF boundingRect() const { return m_rect; } | ||
|
r174 | void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); | ||
|
r142 | |||
public Q_SLOTS: | ||||
|
r621 | void initialize(); | ||
void handleSlicesAdded(QList<QPieSlice*> slices); | ||||
void handleSlicesRemoved(QList<QPieSlice*> slices); | ||||
void handlePieLayoutChanged(); | ||||
|
r566 | void handleSliceChanged(); | ||
void handleDomainChanged(qreal, qreal, qreal, qreal); | ||||
|
r142 | void handleGeometryChanged(const QRectF& rect); | ||
|
r618 | public: | ||
|
r621 | void calculatePieLayout(); | ||
|
r668 | PieSliceData sliceData(QPieSlice *slice); | ||
|
r629 | PieLayout calculateLayout(); | ||
void applyLayout(const PieLayout &layout); | ||||
|
r668 | void updateLayout(QPieSlice *slice, const PieSliceData &sliceData); | ||
|
r629 | void setLayout(const PieLayout &layout); | ||
|
r668 | void setLayout(QPieSlice *slice, const PieSliceData &sliceData); | ||
|
r618 | void destroySlice(QPieSlice *slice); | ||
|
r174 | |||
|
r142 | private: | ||
|
r673 | friend class PieSliceItem; | ||
QHash<QPieSlice*, PieSliceItem*> m_slices; | ||||
|
r174 | QPieSeries *m_series; | ||
|
r142 | QRectF m_rect; | ||
|
r454 | QPointF m_pieCenter; | ||
qreal m_pieRadius; | ||||
|
r659 | ChartPresenter *m_presenter; | ||
|
r142 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
|
r568 | #endif // PIECHARTITEM_H | ||