| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
#ifndef MAINWIDGET_H |
| 5 |
#define MAINWIDGET_H |
| 6 |
|
| 7 |
#include <QtCharts/QChartGlobal> |
| 8 |
#include <QtCharts/QChart> |
| 9 |
#include <QtCharts/QChartView> |
| 10 |
#include <QtWidgets/QWidget> |
| 11 |
#include <QtCharts/QBoxPlotSeries> |
| 12 |
#include <QtCharts/QBarCategoryAxis> |
| 13 |
#include <QtCharts/QBoxSet> |
| 14 |
#include <QtWidgets/QCheckBox> |
| 15 |
#include <QtWidgets/QDoubleSpinBox> |
| 16 |
|
| 17 |
QT_BEGIN_NAMESPACE |
| 18 |
class QGridLayout; |
| 19 |
QT_END_NAMESPACE |
| 20 |
|
| 21 |
class CustomTableModel; |
| 22 |
class PenTool; |
| 23 |
|
| 24 |
QT_USE_NAMESPACE |
| 25 |
|
| 26 |
class MainWidget : public QWidget |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
public: |
| 30 |
explicit MainWidget(QWidget *parent = 0); |
| 31 |
|
| 32 |
signals: |
| 33 |
|
| 34 |
private: |
| 35 |
void initThemeCombo(QGridLayout *grid); |
| 36 |
void initCheckboxes(QGridLayout *grid); |
| 37 |
void updateAxis(int categoryCount); |
| 38 |
|
| 39 |
private slots: |
| 40 |
void addSeries(); |
| 41 |
void removeSeries(); |
| 42 |
void addBox(); |
| 43 |
void insertBox(); |
| 44 |
void removeBox(); |
| 45 |
void clear(); |
| 46 |
void clearBox(); |
| 47 |
void setBrush(); |
| 48 |
void animationToggled(bool enabled); |
| 49 |
void legendToggled(bool enabled); |
| 50 |
void titleToggled(bool enabled); |
| 51 |
void modelMapperToggled(bool enabled); |
| 52 |
void changeChartTheme(int themeIndex); |
| 53 |
void boxClicked(QBoxSet *set); |
| 54 |
void boxHovered(bool state, QBoxSet *set); |
| 55 |
void boxPressed(QBoxSet *set); |
| 56 |
void boxReleased(QBoxSet *set); |
| 57 |
void boxDoubleClicked(QBoxSet *set); |
| 58 |
void singleBoxClicked(); |
| 59 |
void singleBoxHovered(bool state); |
| 60 |
void singleBoxPressed(); |
| 61 |
void singleBoxReleased(); |
| 62 |
void singleBoxDoubleClicked(); |
| 63 |
void changePen(); |
| 64 |
void antialiasingToggled(bool); |
| 65 |
void boxOutlineToggled(bool); |
| 66 |
void setBoxWidth(double width); |
| 67 |
|
| 68 |
private: |
| 69 |
QChart *m_chart; |
| 70 |
QChartView *m_chartView; |
| 71 |
QGridLayout *m_scatterLayout; |
| 72 |
QBarCategoryAxis *m_axis; |
| 73 |
CustomTableModel *m_model; |
| 74 |
PenTool *m_penTool; |
| 75 |
int m_rowPos; |
| 76 |
int m_seriesCount; |
| 77 |
QBoxPlotSeries *m_series[10]; |
| 78 |
QCheckBox *m_boxOutlined; |
| 79 |
QDoubleSpinBox *m_boxWidthSB; |
| 80 |
}; |
| 81 |
|
| 82 |
#endif // MAINWIDGET_H |