| 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 MAINWINDOW_H | 
| 31 | #define MAINWINDOW_H | 
| 32 |  | 
| 33 | #include "datasource.h" | 
| 34 | #include <QtWidgets/QMainWindow> | 
| 35 | #include <QtCharts/QChart> | 
| 36 |  | 
| 37 | QT_BEGIN_NAMESPACE | 
| 38 | class QBrush; | 
| 39 | class QPen; | 
| 40 |  | 
| 41 | namespace Ui { | 
| 42 | class MainWindow; | 
| 43 | } | 
| 44 | QT_END_NAMESPACE | 
| 45 |  | 
| 46 |  | 
| 47 | QT_CHARTS_USE_NAMESPACE | 
| 48 |  | 
| 49 | class MainWindow : public QMainWindow | 
| 50 | { | 
| 51 |     Q_OBJECT | 
| 52 |  | 
| 53 | public: | 
| 54 |     explicit MainWindow(QWidget *parent = 0); | 
| 55 |     ~MainWindow(); | 
| 56 |  | 
| 57 | public slots: | 
| 58 |     void xMinChanged(double value); | 
| 59 |     void xMaxChanged(double value); | 
| 60 |     void yMinChanged(double value); | 
| 61 |     void yMaxChanged(double value); | 
| 62 |     void animationIndexChanged(int index); | 
| 63 |     void xRangeChanged(qreal min, qreal max); | 
| 64 |     void yRangeChanged(qreal min, qreal max); | 
| 65 |     void xAxisIndexChanged(int index); | 
| 66 |     void yAxisIndexChanged(int index); | 
| 67 |     void backgroundIndexChanged(int index); | 
| 68 |     void plotAreaIndexChanged(int index); | 
| 69 |     void themeIndexChanged(int index); | 
| 70 |     void addSeriesClicked(); | 
| 71 |     void removeSeriesClicked(); | 
| 72 |     void addGLSeriesClicked(); | 
| 73 |     void countIndexChanged(int index); | 
| 74 |     void colorIndexChanged(int index); | 
| 75 |     void widthIndexChanged(int index); | 
| 76 |     void antiAliasCheckBoxClicked(bool checked); | 
| 77 |     void handleHovered(const QPointF &point, bool state); | 
| 78 |     void handleClicked(const QPointF &point); | 
| 79 |     void handlePressed(const QPointF &point); | 
| 80 |     void handleReleased(const QPointF &point); | 
| 81 |     void handleDoubleClicked(const QPointF &point); | 
| 82 |  | 
| 83 | private: | 
| 84 |     enum AxisMode { | 
| 85 |         AxisModeNone, | 
| 86 |         AxisModeValue, | 
| 87 |         AxisModeLogValue, | 
| 88 |         AxisModeDateTime, | 
| 89 |         AxisModeCategory | 
| 90 |     }; | 
| 91 |  | 
| 92 |     void initXYValueChart(); | 
| 93 |     void setXAxis(AxisMode mode); | 
| 94 |     void setYAxis(AxisMode mode); | 
| 95 |  | 
| 96 |     void applyRanges(); | 
| 97 |     void applyCategories(); | 
| 98 |     void addSeries(bool gl); | 
| 99 |  | 
| 100 |     Ui::MainWindow *ui; | 
| 101 |  | 
| 102 |     qreal m_xMin; | 
| 103 |     qreal m_xMax; | 
| 104 |     qreal m_yMin; | 
| 105 |     qreal m_yMax; | 
| 106 |     QBrush *m_backgroundBrush; | 
| 107 |     QBrush *m_plotAreaBackgroundBrush; | 
| 108 |     QPen *m_backgroundPen; | 
| 109 |     QPen *m_plotAreaBackgroundPen; | 
| 110 |     QChart::AnimationOptions m_animationOptions; | 
| 111 |  | 
| 112 |     QChart *m_chart; | 
| 113 |     QAbstractAxis *m_xAxis; | 
| 114 |     QAbstractAxis *m_yAxis; | 
| 115 |     AxisMode m_xAxisMode; | 
| 116 |     AxisMode m_yAxisMode; | 
| 117 |  | 
| 118 |     QList<QXYSeries *> m_seriesList; | 
| 119 |     DataSource m_dataSource; | 
| 120 |     int m_pointCount; | 
| 121 | }; | 
| 122 |  | 
| 123 | #endif // MAINWINDOW_H | 
| 124 |  |