splinechartitem_p.h
109 lines
| 3.5 KiB
| text/x-c
|
CLexer
Miikka Heikkinen
|
r2854 | /**************************************************************************** | ||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** Copyright (C) 2016 The Qt Company Ltd. | ||
** Contact: https://www.qt.io/licensing/ | ||||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** This file is part of the Qt Charts module of the Qt Toolkit. | ||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** $QT_BEGIN_LICENSE:GPL$ | ||
Titta Heikkala
|
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 | ||||
Miikka Heikkinen
|
r2854 | ** and conditions see https://www.qt.io/terms-conditions. For further | ||
** information use the contact form at https://www.qt.io/contact-us. | ||||
** | ||||
** GNU General Public License Usage | ||||
** Alternatively, this file may be used under the terms of the GNU | ||||
** General Public License version 3 or (at your option) any later version | ||||
** approved by the KDE Free Qt Foundation. The licenses are as published by | ||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||||
** included in the packaging of this file. Please review the following | ||||
** information to ensure the GNU General Public License requirements will | ||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||||
Jani Honkonen
|
r794 | ** | ||
Titta Heikkala
|
r2845 | ** $QT_END_LICENSE$ | ||
** | ||||
Miikka Heikkinen
|
r2854 | ****************************************************************************/ | ||
Jani Honkonen
|
r794 | |||
unknown
|
r1366 | // W A R N I N G | ||
// ------------- | ||||
// | ||||
Titta Heikkala
|
r2807 | // This file is not part of the Qt 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. | ||||
Marek Rosa
|
r460 | #ifndef SPLINECHARTITEM_P_H | ||
#define SPLINECHARTITEM_P_H | ||||
Marek Rosa
|
r295 | |||
Titta Heikkala
|
r2714 | #include <QtCharts/QSplineSeries> | ||
#include <private/xychart_p.h> | ||||
Michal Klocek
|
r622 | |||
Titta Heikkala
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
Marek Rosa
|
r295 | |||
Michal Klocek
|
r1735 | class SplineAnimation; | ||
Michal Klocek
|
r2273 | class SplineChartItem : public XYChart | ||
Marek Rosa
|
r295 | { | ||
Q_OBJECT | ||||
Michal Klocek
|
r1218 | Q_INTERFACES(QGraphicsItem) | ||
Marek Rosa
|
r295 | public: | ||
Miikka Heikkinen
|
r2483 | SplineChartItem(QSplineSeries *series, QGraphicsItem *item = 0); | ||
Marek Rosa
|
r295 | |||
Michal Klocek
|
r465 | //from QGraphicsItem | ||
QRectF boundingRect() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QPainterPath shape() const; | ||||
Marek Rosa
|
r417 | |||
Michal Klocek
|
r1217 | void setControlGeometryPoints(QVector<QPointF>& points); | ||
QVector<QPointF> controlGeometryPoints() const; | ||||
Jani Honkonen
|
r2104 | void setAnimation(SplineAnimation *animation); | ||
ChartAnimation *animation() const; | ||||
Michal Klocek
|
r1217 | |||
sauimone
|
r775 | public Q_SLOTS: | ||
Michal Klocek
|
r476 | void handleUpdated(); | ||
Michal Klocek
|
r465 | protected: | ||
Michal Klocek
|
r1217 | void updateGeometry(); | ||
Marek Rosa
|
r2372 | QVector<QPointF> calculateControlPoints(const QVector<QPointF> &points); | ||
QVector<qreal> firstControlPoints(const QVector<qreal>& vector); | ||||
Jani Honkonen
|
r2097 | void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index); | ||
Michal Klocek
|
r1218 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
Marek Rosa
|
r2256 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||||
Titta Heikkala
|
r2739 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); | ||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); | ||||
Marek Rosa
|
r419 | |||
Michal Klocek
|
r465 | private: | ||
Marek Rosa
|
r961 | QSplineSeries *m_series; | ||
Michal Klocek
|
r465 | QPainterPath m_path; | ||
Miikka Heikkinen
|
r2483 | QPainterPath m_pathPolarRight; | ||
QPainterPath m_pathPolarLeft; | ||||
QPainterPath m_fullPath; | ||||
Michal Klocek
|
r465 | QRectF m_rect; | ||
Michal Klocek
|
r580 | QPen m_linePen; | ||
QPen m_pointPen; | ||||
bool m_pointsVisible; | ||||
Michal Klocek
|
r622 | QVector<QPointF> m_controlPoints; | ||
Miikka Heikkinen
|
r2483 | QVector<QPointF> m_visiblePoints; | ||
Jani Honkonen
|
r2104 | SplineAnimation *m_animation; | ||
Michal Klocek
|
r476 | |||
Titta Heikkala
|
r2689 | bool m_pointLabelsVisible; | ||
QString m_pointLabelsFormat; | ||||
QFont m_pointLabelsFont; | ||||
QColor m_pointLabelsColor; | ||||
Titta Heikkala
|
r2815 | bool m_pointLabelsClipping; | ||
Titta Heikkala
|
r2689 | |||
Titta Heikkala
|
r2739 | QPointF m_lastMousePos; | ||
bool m_mousePressed; | ||||
Michal Klocek
|
r622 | friend class SplineAnimation; | ||
Marek Rosa
|
r295 | }; | ||
Titta Heikkala
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
Marek Rosa
|
r295 | |||
Marek Rosa
|
r460 | #endif // SPLINECHARTITEM_P_H | ||