pieslice_p.h
74 lines
| 1.8 KiB
| text/x-c
|
CLexer
|
r51 | #ifndef PIESLICE_H | ||
#define PIESLICE_H | ||||
#include "qchartglobal.h" | ||||
|
r103 | #include "charttheme_p.h" | ||
|
r157 | #include "qpieseries.h" | ||
|
r51 | #include <QGraphicsItem> | ||
#include <QRectF> | ||||
#include <QColor> | ||||
|
r157 | #include <QPen> | ||
|
r51 | |||
|
r413 | #define PIESLICE_LABEL_GAP 5 | ||
|
r51 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r146 | class PiePresenter; | ||
|
r174 | class PieSliceLabel; | ||
|
r203 | class QPieSlice; | ||
|
r51 | |||
|
r174 | class PieSlice : public QGraphicsObject | ||
|
r51 | { | ||
|
r174 | Q_OBJECT | ||
|
r51 | public: | ||
|
r203 | PieSlice(QGraphicsItem* parent = 0); | ||
|
r51 | ~PieSlice(); | ||
public: // from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
QPainterPath shape() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
|
r142 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
|
r157 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||
|
r142 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
|
r51 | |||
|
r174 | Q_SIGNALS: | ||
void clicked(); | ||||
|
r203 | void hoverEnter(); | ||
void hoverLeave(); | ||||
|
r157 | |||
|
r203 | public Q_SLOTS: | ||
|
r454 | void setPieCenterAndRadius(QPointF center, qreal radius); | ||
|
r203 | void updateGeometry(); | ||
void updateData(const QPieSlice *sliceData); | ||||
|
r157 | |||
|
r289 | public: | ||
|
r437 | static QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, bool exploded, qreal explodeDistance, qreal* centerAngle, QPointF* armStart); | ||
static QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF* textStart); | ||||
static QRectF labelTextRect(QFont font, QString text); | ||||
|
r289 | |||
|
r142 | private: | ||
|
r454 | QPointF m_pieCenter; | ||
qreal m_pieRadius; | ||||
|
r203 | |||
|
r437 | QPainterPath m_slicePath; | ||
|
r355 | qreal m_startAngle; | ||
|
r289 | qreal m_angleSpan; | ||
|
r203 | bool m_isExploded; | ||
|
r454 | qreal m_explodeDistanceFactor; | ||
|
r437 | bool m_labelVisible; | ||
|
r203 | QPen m_pen; | ||
QBrush m_brush; | ||||
|
r437 | |||
QPainterPath m_labelArmPath; | ||||
|
r454 | qreal m_labelArmLengthFactor; | ||
|
r437 | QPen m_labelArmPen; | ||
QRectF m_labelTextRect; | ||||
QFont m_labelFont; | ||||
QString m_labelText; | ||||
|
r51 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // PIESLICE_H | ||||