| 1 | // Copyright (C) 2016 The Qt Company Ltd. | 
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
| 3 |  | 
| 4 | //  W A R N I N G | 
| 5 | //  ------------- | 
| 6 | // | 
| 7 | // This file is not part of the Qt Chart API.  It exists purely as an | 
| 8 | // implementation detail.  This header file may change from version to | 
| 9 | // version without notice, or even be removed. | 
| 10 | // | 
| 11 | // We mean it. | 
| 12 |  | 
| 13 | #ifndef QXYMODELMAPPER_P_H | 
| 14 | #define QXYMODELMAPPER_P_H | 
| 15 |  | 
| 16 | #include <QtCharts/QXYModelMapper> | 
| 17 | #include <QtCharts/private/qchartglobal_p.h> | 
| 18 | #include <QtCore/QObject> | 
| 19 |  | 
| 20 | QT_BEGIN_NAMESPACE | 
| 21 | class QModelIndex; | 
| 22 | class QAbstractItemModel; | 
| 23 | class QPointF; | 
| 24 | QT_END_NAMESPACE | 
| 25 |  | 
| 26 | QT_BEGIN_NAMESPACE | 
| 27 |  | 
| 28 | class QXYModelMapper; | 
| 29 | class QXYSeries; | 
| 30 |  | 
| 31 | class Q_CHARTS_EXPORT QXYModelMapperPrivate : public QObject | 
| 32 | { | 
| 33 |     Q_OBJECT | 
| 34 |  | 
| 35 | public: | 
| 36 |     QXYModelMapperPrivate(QXYModelMapper *q); | 
| 37 |  | 
| 38 | public Q_SLOTS: | 
| 39 |     // for the model | 
| 40 |     void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); | 
| 41 |     void modelRowsAdded(QModelIndex parent, int start, int end); | 
| 42 |     void modelRowsRemoved(QModelIndex parent, int start, int end); | 
| 43 |     void modelColumnsAdded(QModelIndex parent, int start, int end); | 
| 44 |     void modelColumnsRemoved(QModelIndex parent, int start, int end); | 
| 45 |     void handleModelDestroyed(); | 
| 46 |  | 
| 47 |     // for the series | 
| 48 |     void handlePointAdded(int pointPos); | 
| 49 |     void handlePointRemoved(int pointPos); | 
| 50 |     void handlePointsRemoved(int pointPos, int count); | 
| 51 |     void handlePointReplaced(int pointPos); | 
| 52 |     void handleSeriesDestroyed(); | 
| 53 |  | 
| 54 |     void initializeXYFromModel(); | 
| 55 |  | 
| 56 | private: | 
| 57 |     QModelIndex xModelIndex(int xPos); | 
| 58 |     QModelIndex yModelIndex(int yPos); | 
| 59 |     void insertData(int start, int end); | 
| 60 |     void removeData(int start, int end); | 
| 61 |     void blockModelSignals(bool block = true); | 
| 62 |     void blockSeriesSignals(bool block = true); | 
| 63 |     qreal valueFromModel(QModelIndex index); | 
| 64 |     void setValueToModel(QModelIndex index, qreal value); | 
| 65 |  | 
| 66 | private: | 
| 67 |     QXYSeries *m_series; | 
| 68 |     QAbstractItemModel *m_model; | 
| 69 |     int m_first; | 
| 70 |     int m_count; | 
| 71 |     Qt::Orientation m_orientation; | 
| 72 |     int m_xSection; | 
| 73 |     int m_ySection; | 
| 74 |     bool m_seriesSignalsBlock; | 
| 75 |     bool m_modelSignalsBlock; | 
| 76 |  | 
| 77 | private: | 
| 78 |     QXYModelMapper *q_ptr; | 
| 79 |     Q_DECLARE_PUBLIC(QXYModelMapper) | 
| 80 | }; | 
| 81 |  | 
| 82 | QT_END_NAMESPACE | 
| 83 |  | 
| 84 | #endif // QXYMODELMAPPER_P_H | 
| 85 |  |