piepresenter_p.h
51 lines
| 1.2 KiB
| text/x-c
|
CLexer
Jani Honkonen
|
r146 | #ifndef PIEPRESENTER_H | ||
#define PIEPRESENTER_H | ||||
Jani Honkonen
|
r142 | |||
#include "chartitem_p.h" | ||||
#include "qpieseries.h" | ||||
Jani Honkonen
|
r174 | #include <QSignalMapper> | ||
Jani Honkonen
|
r142 | |||
class QGraphicsItem; | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class PieSlice; | ||||
Jani Honkonen
|
r289 | #define PI 3.14159265 // TODO: is this defined in some header? | ||
Jani Honkonen
|
r146 | class PiePresenter : public QObject, public ChartItem | ||
Jani Honkonen
|
r142 | { | ||
Q_OBJECT | ||||
public: | ||||
// TODO: use a generic data class instead of x and y | ||||
Jani Honkonen
|
r146 | PiePresenter(QGraphicsItem *parent, QPieSeries *series); | ||
~PiePresenter(); | ||||
Jani Honkonen
|
r142 | |||
Jani Honkonen
|
r157 | public: // from QGraphicsItem | ||
Jani Honkonen
|
r142 | QRectF boundingRect() const { return m_rect; } | ||
Jani Honkonen
|
r174 | void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); | ||
Jani Honkonen
|
r142 | |||
public: | ||||
QRectF pieRect() const { return m_pieRect; } | ||||
public Q_SLOTS: | ||||
Jani Honkonen
|
r174 | void handleSeriesChanged(const QPieSeries::ChangeSet& changeSet); | ||
Jani Honkonen
|
r142 | void handleDomainChanged(const Domain& domain); | ||
void handleGeometryChanged(const QRectF& rect); | ||||
Jani Honkonen
|
r163 | void updateGeometry(); | ||
Jani Honkonen
|
r142 | |||
Jani Honkonen
|
r174 | private: | ||
Jani Honkonen
|
r203 | void addSlice(QPieSlice* sliceData); | ||
Jani Honkonen
|
r289 | void updateSlice(QPieSlice* sliceData); | ||
Jani Honkonen
|
r203 | void deleteSlice(QPieSlice* sliceData); | ||
Jani Honkonen
|
r174 | |||
Jani Honkonen
|
r142 | private: | ||
friend class PieSlice; | ||||
Jani Honkonen
|
r203 | QHash<QPieSlice*, PieSlice*> m_slices; | ||
Jani Honkonen
|
r174 | QPieSeries *m_series; | ||
Jani Honkonen
|
r142 | QRectF m_rect; | ||
QRectF m_pieRect; | ||||
}; | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
Jani Honkonen
|
r146 | #endif // PIEPRESENTER_H | ||