splinechartitem_p.h
101 lines
| 3.0 KiB
| text/x-c
|
CLexer
|
r2845 | /****************************************************************************** | ||
|
r794 | ** | ||
|
r2845 | ** Copyright (C) 2015 The Qt Company Ltd. | ||
** Contact: http://www.qt.io/licensing/ | ||||
|
r794 | ** | ||
|
r2740 | ** This file is part of the Qt Charts module. | ||
|
r794 | ** | ||
|
r2845 | ** $QT_BEGIN_LICENSE:COMM$ | ||
|
r794 | ** | ||
|
r2845 | ** Commercial License Usage | ||
** Licensees holding valid commercial Qt licenses may use this file in | ||||
** accordance with the commercial license agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and The Qt Company. For licensing terms | ||||
** and conditions see http://www.qt.io/terms-conditions. For further | ||||
** information use the contact form at http://www.qt.io/contact-us. | ||||
|
r794 | ** | ||
|
r2845 | ** $QT_END_LICENSE$ | ||
** | ||||
******************************************************************************/ | ||||
|
r794 | |||
|
r1366 | // W A R N I N G | ||
// ------------- | ||||
// | ||||
|
r2807 | // This file is not part of the Qt 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; | ||||
|
r2815 | bool m_pointLabelsClipping; | ||
|
r2689 | |||
|
r2739 | QPointF m_lastMousePos; | ||
bool m_mousePressed; | ||||
|
r622 | friend class SplineAnimation; | ||
|
r295 | }; | ||
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
|
r295 | |||
|
r460 | #endif // SPLINECHARTITEM_P_H | ||