piesliceitem_p.h
91 lines
| 2.6 KiB
| text/x-c
|
CLexer
Jani Honkonen
|
r794 | /**************************************************************************** | ||
** | ||||
Miikka Heikkinen
|
r2432 | ** Copyright (C) 2013 Digia Plc | ||
Jani Honkonen
|
r794 | ** All rights reserved. | ||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
Miikka Heikkinen
|
r2574 | ** This file is part of the Qt Enterprise Charts Add-on. | ||
Jani Honkonen
|
r794 | ** | ||
** $QT_BEGIN_LICENSE$ | ||||
Miikka Heikkinen
|
r2574 | ** Licensees holding valid Qt Enterprise licenses may use this file in | ||
** accordance with the Qt Enterprise License Agreement provided with the | ||||
Jani Honkonen
|
r794 | ** Software or, alternatively, in accordance with the terms contained in | ||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
unknown
|
r1366 | // W A R N I N G | ||
// ------------- | ||||
// | ||||
Miikka Heikkinen
|
r2574 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | ||
unknown
|
r1366 | // implementation detail. This header file may change from version to | ||
// version without notice, or even be removed. | ||||
// | ||||
// We mean it. | ||||
Jani Honkonen
|
r673 | #ifndef PIESLICEITEM_H | ||
#define PIESLICEITEM_H | ||||
Tero Ahola
|
r51 | |||
#include "qchartglobal.h" | ||||
Tero Ahola
|
r103 | #include "charttheme_p.h" | ||
Jani Honkonen
|
r157 | #include "qpieseries.h" | ||
Jani Honkonen
|
r818 | #include "pieslicedata_p.h" | ||
Tero Ahola
|
r51 | #include <QGraphicsItem> | ||
#include <QRectF> | ||||
#include <QColor> | ||||
Jani Honkonen
|
r157 | #include <QPen> | ||
Tero Ahola
|
r51 | |||
Jani Honkonen
|
r413 | #define PIESLICE_LABEL_GAP 5 | ||
Tero Ahola
|
r51 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
Jani Honkonen
|
r568 | class PieChartItem; | ||
Jani Honkonen
|
r174 | class PieSliceLabel; | ||
Jani Honkonen
|
r203 | class QPieSlice; | ||
Tero Ahola
|
r51 | |||
Jani Honkonen
|
r673 | class PieSliceItem : public QGraphicsObject | ||
Tero Ahola
|
r51 | { | ||
Jani Honkonen
|
r174 | Q_OBJECT | ||
Tero Ahola
|
r51 | public: | ||
Jani Honkonen
|
r2104 | PieSliceItem(QGraphicsItem *parent = 0); | ||
Jani Honkonen
|
r673 | ~PieSliceItem(); | ||
Tero Ahola
|
r51 | |||
Jani Honkonen
|
r1074 | // from QGraphicsItem | ||
Tero Ahola
|
r51 | 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
|
r1074 | void setLayout(const PieSliceData &sliceData); | ||
static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice); | ||||
Jani Honkonen
|
r174 | Q_SIGNALS: | ||
Jani Honkonen
|
r707 | void clicked(Qt::MouseButtons buttons); | ||
Jani Honkonen
|
r1009 | void hovered(bool state); | ||
Jani Honkonen
|
r157 | |||
Jani Honkonen
|
r1074 | private: | ||
Jani Honkonen
|
r203 | void updateGeometry(); | ||
Jani Honkonen
|
r972 | QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart); | ||
QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart); | ||||
Jani Honkonen
|
r289 | |||
Jani Honkonen
|
r142 | private: | ||
Jani Honkonen
|
r668 | PieSliceData m_data; | ||
Jani Honkonen
|
r621 | QRectF m_boundingRect; | ||
Jani Honkonen
|
r437 | QPainterPath m_slicePath; | ||
QPainterPath m_labelArmPath; | ||||
QRectF m_labelTextRect; | ||||
Jani Honkonen
|
r1083 | bool m_hovered; | ||
Titta Heikkala
|
r2626 | QGraphicsTextItem *m_labelItem; | ||
Jani Honkonen
|
r2321 | |||
friend class PieSliceAnimation; | ||||
Tero Ahola
|
r51 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
Jani Honkonen
|
r673 | #endif // PIESLICEITEM_H | ||