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 QCANDLESTICKMODELMAPPER_P_H |
14 | #define QCANDLESTICKMODELMAPPER_P_H |
15 | |
16 | #include <QtCharts/QCandlestickModelMapper> |
17 | #include <QtCharts/private/qchartglobal_p.h> |
18 | #include <QtCore/QObject> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | class QModelIndex; |
22 | QT_END_NAMESPACE |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QCandlestickSet; |
27 | |
28 | class Q_CHARTS_PRIVATE_EXPORT QCandlestickModelMapperPrivate : public QObject |
29 | { |
30 | Q_OBJECT |
31 | |
32 | public: |
33 | explicit QCandlestickModelMapperPrivate(QCandlestickModelMapper *q); |
34 | |
35 | Q_SIGNALS: |
36 | void timestampChanged(); |
37 | void openChanged(); |
38 | void highChanged(); |
39 | void lowChanged(); |
40 | void closeChanged(); |
41 | void firstSetSectionChanged(); |
42 | void lastSetSectionChanged(); |
43 | |
44 | private Q_SLOTS: |
45 | void initializeCandlestickFromModel(); |
46 | |
47 | // for the model |
48 | void modelDataUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
49 | void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last); |
50 | void modelRowsInserted(QModelIndex parent, int start, int end); |
51 | void modelRowsRemoved(QModelIndex parent, int start, int end); |
52 | void modelColumnsInserted(QModelIndex parent, int start, int end); |
53 | void modelColumnsRemoved(QModelIndex parent, int start, int end); |
54 | void modelDestroyed(); |
55 | |
56 | // for the series |
57 | void candlestickSetsAdded(const QList<QCandlestickSet *> &sets); |
58 | void candlestickSetsRemoved(const QList<QCandlestickSet *> &sets); |
59 | void candlestickSetChanged(); |
60 | void seriesDestroyed(); |
61 | |
62 | private: |
63 | QCandlestickSet *candlestickSet(QModelIndex index); |
64 | QModelIndex candlestickModelIndex(int section, int pos); |
65 | void insertData(int start, int end); |
66 | void removeData(int start, int end); |
67 | void blockModelSignals(bool block = true); |
68 | void blockSeriesSignals(bool block = true); |
69 | |
70 | private: |
71 | QAbstractItemModel *m_model; |
72 | QCandlestickSeries *m_series; |
73 | int m_timestamp; |
74 | int m_open; |
75 | int m_high; |
76 | int m_low; |
77 | int m_close; |
78 | int m_firstSetSection; |
79 | int m_lastSetSection; |
80 | QList<QCandlestickSet *> m_sets; |
81 | bool m_modelSignalsBlock; |
82 | bool m_seriesSignalsBlock; |
83 | |
84 | private: |
85 | QCandlestickModelMapper *q_ptr; |
86 | Q_DECLARE_PUBLIC(QCandlestickModelMapper) |
87 | }; |
88 | |
89 | QT_END_NAMESPACE |
90 | |
91 | #endif // QCANDLESTICKMODELMAPPER_P_H |
92 | |