pieslice.h
49 lines
| 1.1 KiB
| text/x-c
|
CLexer
Tero Ahola
|
r51 | #ifndef PIESLICE_H | ||
#define PIESLICE_H | ||||
#include "qchartglobal.h" | ||||
Tero Ahola
|
r103 | #include "charttheme_p.h" | ||
Jani Honkonen
|
r157 | #include "qpieseries.h" | ||
Tero Ahola
|
r51 | #include <QGraphicsItem> | ||
#include <QRectF> | ||||
#include <QColor> | ||||
Jani Honkonen
|
r157 | #include <QPen> | ||
Tero Ahola
|
r51 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Jani Honkonen
|
r146 | class PiePresenter; | ||
Tero Ahola
|
r51 | |||
class PieSlice : public QGraphicsItem | ||||
{ | ||||
public: | ||||
Jani Honkonen
|
r157 | PieSlice(PiePresenter *piePresenter, int seriesIndex, qreal startAngle, qreal span); | ||
Tero Ahola
|
r51 | ~PieSlice(); | ||
public: // from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
QPainterPath shape() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
Jani Honkonen
|
r142 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
Jani Honkonen
|
r157 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||
Jani Honkonen
|
r142 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
Tero Ahola
|
r51 | |||
Jani Honkonen
|
r157 | public: | ||
void updateGeometry(); | ||||
private: | ||||
QPieSlice sliceData(); | ||||
Jani Honkonen
|
r142 | private: | ||
Jani Honkonen
|
r157 | QGraphicsTextItem* m_label; | ||
Jani Honkonen
|
r142 | int m_seriesIndex; | ||
Tero Ahola
|
r51 | qreal m_startAngle; | ||
qreal m_span; | ||||
Jani Honkonen
|
r157 | QPainterPath m_path; | ||
Michal Klocek
|
r143 | QRectF m_rect; | ||
Jani Honkonen
|
r157 | QPointF m_center; | ||
QPen m_pen; | ||||
QBrush m_brush; | ||||
Tero Ahola
|
r51 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // PIESLICE_H | ||||