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 | |
14 | #ifndef BOXPLOTCHARTITEM_H |
15 | #define BOXPLOTCHARTITEM_H |
16 | |
17 | #include <private/boxwhiskers_p.h> |
18 | #include <QtCharts/QBoxPlotSeries> |
19 | #include <QtCharts/private/qchartglobal_p.h> |
20 | #include <private/chartitem_p.h> |
21 | #include <private/boxplotanimation_p.h> |
22 | #include <QtCharts/QBoxSet> |
23 | #include <QtWidgets/QGraphicsItem> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class BoxPlotSeriesPrivate; |
28 | |
29 | class Q_CHARTS_PRIVATE_EXPORT BoxPlotChartItem : public ChartItem |
30 | { |
31 | Q_OBJECT |
32 | public: |
33 | BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item = 0); |
34 | ~BoxPlotChartItem(); |
35 | |
36 | void setAnimation(BoxPlotAnimation *animation); |
37 | |
38 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; |
39 | QRectF boundingRect() const override; |
40 | |
41 | public Q_SLOTS: |
42 | void handleSeriesVisibleChanged(); |
43 | void handleOpacityChanged(); |
44 | void handleDataStructureChanged(); |
45 | void handleDomainUpdated() override; |
46 | void handleLayoutChanged(); |
47 | void handleUpdatedBars(); |
48 | void handleBoxsetRemove(const QList<QBoxSet *> &barSets); |
49 | |
50 | private: |
51 | virtual QList<QRectF> calculateLayout(); |
52 | void initializeLayout(); |
53 | bool updateBoxGeometry(BoxWhiskers *box, int index); |
54 | |
55 | protected: |
56 | friend class QBoxPlotSeriesPrivate; |
57 | QBoxPlotSeries *m_series; // Not owned. |
58 | QList<BoxWhiskers *> m_boxes; |
59 | QHash<QBoxSet *, BoxWhiskers *> m_boxTable; |
60 | int m_seriesIndex; |
61 | int m_seriesCount; |
62 | |
63 | BoxPlotAnimation *m_animation; |
64 | |
65 | QRectF m_boundingRect; |
66 | }; |
67 | |
68 | QT_END_NAMESPACE |
69 | |
70 | #endif // BOXPLOTCHARTITEM_H |
71 | |