1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Charts module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef MAINWIDGET_H
31#define MAINWIDGET_H
32
33#include <QtCharts/QChartGlobal>
34#include <QtCharts/QChart>
35#include <QtCharts/QChartView>
36#include <QtWidgets/QWidget>
37#include <QtCharts/QBoxPlotSeries>
38#include <QtCharts/QBarCategoryAxis>
39#include <QtCharts/QBoxSet>
40#include <QtWidgets/QCheckBox>
41#include <QtWidgets/QDoubleSpinBox>
42
43QT_BEGIN_NAMESPACE
44class QGridLayout;
45QT_END_NAMESPACE
46
47class CustomTableModel;
48class PenTool;
49
50QT_CHARTS_USE_NAMESPACE
51
52class MainWidget : public QWidget
53{
54 Q_OBJECT
55public:
56 explicit MainWidget(QWidget *parent = 0);
57
58signals:
59
60private:
61 void initThemeCombo(QGridLayout *grid);
62 void initCheckboxes(QGridLayout *grid);
63 void updateAxis(int categoryCount);
64
65private slots:
66 void addSeries();
67 void removeSeries();
68 void addBox();
69 void insertBox();
70 void removeBox();
71 void clear();
72 void clearBox();
73 void setBrush();
74 void animationToggled(bool enabled);
75 void legendToggled(bool enabled);
76 void titleToggled(bool enabled);
77 void modelMapperToggled(bool enabled);
78 void changeChartTheme(int themeIndex);
79 void boxClicked(QBoxSet *set);
80 void boxHovered(bool state, QBoxSet *set);
81 void boxPressed(QBoxSet *set);
82 void boxReleased(QBoxSet *set);
83 void boxDoubleClicked(QBoxSet *set);
84 void singleBoxClicked();
85 void singleBoxHovered(bool state);
86 void singleBoxPressed();
87 void singleBoxReleased();
88 void singleBoxDoubleClicked();
89 void changePen();
90 void antialiasingToggled(bool);
91 void boxOutlineToggled(bool);
92 void setBoxWidth(double width);
93
94private:
95 QChart *m_chart;
96 QChartView *m_chartView;
97 QGridLayout *m_scatterLayout;
98 QBarCategoryAxis *m_axis;
99 CustomTableModel *m_model;
100 PenTool *m_penTool;
101 int m_rowPos;
102 int m_seriesCount;
103 QBoxPlotSeries *m_series[10];
104 QCheckBox *m_boxOutlined;
105 QDoubleSpinBox *m_boxWidthSB;
106};
107
108#endif // MAINWIDGET_H
109

source code of qtcharts/tests/manual/boxplottester/mainwidget.h