piechartitem_p.h
56 lines
| 1.5 KiB
| text/x-c
|
CLexer
|
r568 | #ifndef PIECHARTITEM_H | ||
#define PIECHARTITEM_H | ||||
|
r142 | |||
#include "qpieseries.h" | ||||
|
r566 | #include "chartitem_p.h" | ||
#include "pieslice_p.h" | ||||
|
r142 | |||
class QGraphicsItem; | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r566 | class QPieSlice; | ||
|
r142 | |||
|
r568 | class PieChartItem : public QObject, public ChartItem | ||
|
r142 | { | ||
Q_OBJECT | ||||
public: | ||||
// TODO: use a generic data class instead of x and y | ||||
|
r568 | PieChartItem(QGraphicsItem *parent, QPieSeries *series); | ||
~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(); | ||
PieSliceLayout calculateSliceLayout(QPieSlice *slice); | ||||
|
r566 | QVector<PieSliceLayout> calculateLayout(); | ||
|
r618 | void applyLayout(QVector<PieSliceLayout> &layout); | ||
void updateLayout(PieSliceLayout &layout); | ||||
void setLayout(QVector<PieSliceLayout> &layout); | ||||
void setLayout(PieSliceLayout &layout); | ||||
void destroySlice(QPieSlice *slice); | ||||
|
r174 | |||
|
r142 | private: | ||
friend class PieSlice; | ||||
|
r203 | QHash<QPieSlice*, PieSlice*> m_slices; | ||
|
r174 | QPieSeries *m_series; | ||
|
r142 | QRectF m_rect; | ||
|
r454 | QPointF m_pieCenter; | ||
qreal m_pieRadius; | ||||
|
r437 | QRectF m_debugRect; | ||
|
r142 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
|
r568 | #endif // PIECHARTITEM_H | ||