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 QBOXPLOTMODELMAPPER_P_H
14#define QBOXPLOTMODELMAPPER_P_H
15
16#include <QtCore/QObject>
17#include <QtCharts/QBoxPlotModelMapper>
18#include <QtCharts/private/qchartglobal_p.h>
19
20QT_BEGIN_NAMESPACE
21class QModelIndex;
22QT_END_NAMESPACE
23
24QT_BEGIN_NAMESPACE
25
26class QBoxSet;
27
28class Q_CHARTS_PRIVATE_EXPORT QBoxPlotModelMapperPrivate : public QObject
29{
30 Q_OBJECT
31public:
32 explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
33
34public Q_SLOTS:
35 // for the model
36 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
37 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
38 void modelRowsAdded(QModelIndex parent, int start, int end);
39 void modelRowsRemoved(QModelIndex parent, int start, int end);
40 void modelColumnsAdded(QModelIndex parent, int start, int end);
41 void modelColumnsRemoved(QModelIndex parent, int start, int end);
42 void handleModelDestroyed();
43
44 // for the series
45 void boxSetsAdded(const QList<QBoxSet *> &sets);
46 void boxSetsRemoved(const QList<QBoxSet *> &sets);
47 void boxValueChanged(int index);
48 void handleSeriesDestroyed();
49
50 void initializeBoxFromModel();
51
52private:
53 QBoxSet *boxSet(QModelIndex index);
54 QModelIndex boxModelIndex(int boxSection, int posInBox);
55 void insertData(int start, int end);
56 void removeData(int start, int end);
57 void blockModelSignals(bool block = true);
58 void blockSeriesSignals(bool block = true);
59
60private:
61 QBoxPlotSeries *m_series;
62 QList<QBoxSet *> m_boxSets;
63 QAbstractItemModel *m_model;
64 int m_first;
65 int m_count;
66 Qt::Orientation m_orientation;
67 int m_firstBoxSetSection;
68 int m_lastBoxSetSection;
69 bool m_seriesSignalsBlock;
70 bool m_modelSignalsBlock;
71
72private:
73 QBoxPlotModelMapper *q_ptr;
74 Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
75};
76
77QT_END_NAMESPACE
78
79#endif // QBOXPLOTMODELMAPPER_P_H
80

source code of qtcharts/src/charts/boxplotchart/qboxplotmodelmapper_p.h