splinechartitem_p.h
97 lines
| 2.9 KiB
| text/x-c
|
CLexer
|
r794 | /**************************************************************************** | ||
** | ||||
|
r2688 | ** Copyright (C) 2014 Digia Plc | ||
|
r794 | ** All rights reserved. | ||
|
r2740 | ** For any questions to Digia, please use contact form at http://qt.io | ||
|
r794 | ** | ||
|
r2740 | ** This file is part of the Qt Charts module. | ||
|
r794 | ** | ||
|
r2740 | ** Licensees holding valid commercial license for Qt may use this file in | ||
** accordance with the Qt License Agreement provided with the Software | ||||
** or, alternatively, in accordance with the terms contained in a written | ||||
** agreement between you and Digia. | ||||
|
r794 | ** | ||
** If you have questions regarding the use of this file, please use | ||||
|
r2740 | ** contact form at http://qt.io | ||
|
r794 | ** | ||
****************************************************************************/ | ||||
|
r1366 | // W A R N I N G | ||
// ------------- | ||||
// | ||||
|
r2574 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | ||
|
r1366 | // implementation detail. This header file may change from version to | ||
// version without notice, or even be removed. | ||||
// | ||||
// We mean it. | ||||
|
r460 | #ifndef SPLINECHARTITEM_P_H | ||
#define SPLINECHARTITEM_P_H | ||||
|
r295 | |||
|
r2714 | #include <QtCharts/QSplineSeries> | ||
#include <private/xychart_p.h> | ||||
|
r622 | |||
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
|
r295 | |||
|
r1735 | class SplineAnimation; | ||
|
r2273 | class SplineChartItem : public XYChart | ||
|
r295 | { | ||
Q_OBJECT | ||||
|
r1218 | Q_INTERFACES(QGraphicsItem) | ||
|
r295 | public: | ||
|
r2483 | SplineChartItem(QSplineSeries *series, QGraphicsItem *item = 0); | ||
|
r295 | |||
|
r465 | //from QGraphicsItem | ||
QRectF boundingRect() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QPainterPath shape() const; | ||||
|
r417 | |||
|
r1217 | void setControlGeometryPoints(QVector<QPointF>& points); | ||
QVector<QPointF> controlGeometryPoints() const; | ||||
|
r2104 | void setAnimation(SplineAnimation *animation); | ||
ChartAnimation *animation() const; | ||||
|
r1217 | |||
|
r775 | public Q_SLOTS: | ||
|
r476 | void handleUpdated(); | ||
|
r465 | protected: | ||
|
r1217 | void updateGeometry(); | ||
|
r2372 | QVector<QPointF> calculateControlPoints(const QVector<QPointF> &points); | ||
QVector<qreal> firstControlPoints(const QVector<qreal>& vector); | ||||
|
r2097 | void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index); | ||
|
r1218 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
|
r2256 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||||
|
r2739 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); | ||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); | ||||
|
r419 | |||
|
r465 | private: | ||
|
r961 | QSplineSeries *m_series; | ||
|
r465 | QPainterPath m_path; | ||
|
r2483 | QPainterPath m_pathPolarRight; | ||
QPainterPath m_pathPolarLeft; | ||||
QPainterPath m_fullPath; | ||||
|
r465 | QRectF m_rect; | ||
|
r580 | QPen m_linePen; | ||
QPen m_pointPen; | ||||
bool m_pointsVisible; | ||||
|
r622 | QVector<QPointF> m_controlPoints; | ||
|
r2483 | QVector<QPointF> m_visiblePoints; | ||
|
r2104 | SplineAnimation *m_animation; | ||
|
r476 | |||
|
r2689 | bool m_pointLabelsVisible; | ||
QString m_pointLabelsFormat; | ||||
QFont m_pointLabelsFont; | ||||
QColor m_pointLabelsColor; | ||||
|
r2739 | QPointF m_lastMousePos; | ||
bool m_mousePressed; | ||||
|
r622 | friend class SplineAnimation; | ||
|
r295 | }; | ||
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
|
r295 | |||
|
r460 | #endif // SPLINECHARTITEM_P_H | ||