##// END OF EJS Templates
Fix compilation with namespaced Qt....
Christian Kandeler -
r2774:7b74d88b3f3d
parent child
Show More
@@ -1,50 +1,53
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef WIDGET_H
19 #ifndef WIDGET_H
20 #define WIDGET_H
20 #define WIDGET_H
21
21
22 #include <QtWidgets/QWidget>
22 #include <QtWidgets/QWidget>
23 #include <QtCharts/QChartGlobal>
23 #include <QtCharts/QChartGlobal>
24
24
25 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
26 class QLineSeries;
26 class QLineSeries;
27 class QChart;
27 class QChart;
28 QT_CHARTS_END_NAMESPACE
28 QT_CHARTS_END_NAMESPACE
29
29
30 QT_CHARTS_USE_NAMESPACE
30 QT_CHARTS_USE_NAMESPACE
31
31
32 class XYSeriesIODevice;
32 class XYSeriesIODevice;
33
34 QT_BEGIN_NAMESPACE
33 class QAudioInput;
35 class QAudioInput;
36 QT_END_NAMESPACE
34
37
35 class Widget : public QWidget
38 class Widget : public QWidget
36 {
39 {
37 Q_OBJECT
40 Q_OBJECT
38
41
39 public:
42 public:
40 Widget(QWidget *parent = 0);
43 Widget(QWidget *parent = 0);
41 ~Widget();
44 ~Widget();
42
45
43 private:
46 private:
44 XYSeriesIODevice *m_device;
47 XYSeriesIODevice *m_device;
45 QChart *m_chart;
48 QChart *m_chart;
46 QLineSeries *m_series;
49 QLineSeries *m_series;
47 QAudioInput *m_audioInput;
50 QAudioInput *m_audioInput;
48 };
51 };
49
52
50 #endif // WIDGET_H
53 #endif // WIDGET_H
@@ -1,50 +1,52
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef CALLOUT_H
19 #ifndef CALLOUT_H
20 #define CALLOUT_H
20 #define CALLOUT_H
21
21
22 #include <QtWidgets/QGraphicsItem>
22 #include <QtWidgets/QGraphicsItem>
23 #include <QtGui/QFont>
23 #include <QtGui/QFont>
24
24
25 QT_BEGIN_NAMESPACE
25 class QGraphicsSceneMouseEvent;
26 class QGraphicsSceneMouseEvent;
27 QT_END_NAMESPACE
26
28
27 class Callout : public QGraphicsItem
29 class Callout : public QGraphicsItem
28 {
30 {
29 public:
31 public:
30 Callout(QGraphicsItem * parent = 0);
32 Callout(QGraphicsItem * parent = 0);
31
33
32 void setText(const QString &text);
34 void setText(const QString &text);
33 void setAnchor(QPointF point);
35 void setAnchor(QPointF point);
34
36
35 QRectF boundingRect() const;
37 QRectF boundingRect() const;
36 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget);
38 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget);
37
39
38 protected:
40 protected:
39 void mousePressEvent(QGraphicsSceneMouseEvent *event);
41 void mousePressEvent(QGraphicsSceneMouseEvent *event);
40 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
42 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
41
43
42 private:
44 private:
43 QString m_text;
45 QString m_text;
44 QRectF m_textRect;
46 QRectF m_textRect;
45 QRectF m_rect;
47 QRectF m_rect;
46 QPointF m_anchor;
48 QPointF m_anchor;
47 QFont m_font;
49 QFont m_font;
48 };
50 };
49
51
50 #endif // CALLOUT_H
52 #endif // CALLOUT_H
@@ -1,57 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef VIEW_H
19 #ifndef VIEW_H
20 #define VIEW_H
20 #define VIEW_H
21 #include <QtWidgets/QGraphicsView>
21 #include <QtWidgets/QGraphicsView>
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23
23
24 QT_BEGIN_NAMESPACE
25 class QGraphicsScene;
26 class QMouseEvent;
27 class QResizeEvent;
28 QT_END_NAMESPACE
29
24 QT_CHARTS_BEGIN_NAMESPACE
30 QT_CHARTS_BEGIN_NAMESPACE
25 class QChart;
31 class QChart;
26 QT_CHARTS_END_NAMESPACE
32 QT_CHARTS_END_NAMESPACE
27
33
28 class QGraphicsScene;
29 class QResizeEvent;
30 class Callout;
34 class Callout;
31 class QMouseEvent;
32
35
33 QT_CHARTS_USE_NAMESPACE
36 QT_CHARTS_USE_NAMESPACE
34
37
35 class View: public QGraphicsView
38 class View: public QGraphicsView
36 {
39 {
37 Q_OBJECT
40 Q_OBJECT
38
41
39 public:
42 public:
40 View(QWidget *parent = 0);
43 View(QWidget *parent = 0);
41
44
42 protected:
45 protected:
43 void resizeEvent(QResizeEvent *event);
46 void resizeEvent(QResizeEvent *event);
44 void mouseMoveEvent(QMouseEvent *event);
47 void mouseMoveEvent(QMouseEvent *event);
45
48
46 public slots:
49 public slots:
47 void keepCallout();
50 void keepCallout();
48 void tooltip(QPointF point, bool state);
51 void tooltip(QPointF point, bool state);
49
52
50 private:
53 private:
51 QGraphicsSimpleTextItem *m_coordX;
54 QGraphicsSimpleTextItem *m_coordX;
52 QGraphicsSimpleTextItem *m_coordY;
55 QGraphicsSimpleTextItem *m_coordY;
53 QChart *m_chart;
56 QChart *m_chart;
54 Callout *m_tooltip;
57 Callout *m_tooltip;
55 };
58 };
56
59
57 #endif
60 #endif
@@ -1,75 +1,77
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef THEMEWIDGET_H
19 #ifndef THEMEWIDGET_H
20 #define THEMEWIDGET_H
20 #define THEMEWIDGET_H
21
21
22 #include <QtWidgets/QWidget>
22 #include <QtWidgets/QWidget>
23 #include <QtCharts/QChartGlobal>
23 #include <QtCharts/QChartGlobal>
24
24
25 QT_BEGIN_NAMESPACE
25 class QComboBox;
26 class QComboBox;
26 class QCheckBox;
27 class QCheckBox;
28 QT_END_NAMESPACE
27
29
28 QT_CHARTS_BEGIN_NAMESPACE
30 QT_CHARTS_BEGIN_NAMESPACE
29 class QChartView;
31 class QChartView;
30 class QChart;
32 class QChart;
31 QT_CHARTS_END_NAMESPACE
33 QT_CHARTS_END_NAMESPACE
32
34
33 typedef QPair<QPointF, QString> Data;
35 typedef QPair<QPointF, QString> Data;
34 typedef QList<Data> DataList;
36 typedef QList<Data> DataList;
35 typedef QList<DataList> DataTable;
37 typedef QList<DataList> DataTable;
36
38
37 QT_CHARTS_USE_NAMESPACE
39 QT_CHARTS_USE_NAMESPACE
38
40
39 class ThemeWidget: public QWidget
41 class ThemeWidget: public QWidget
40 {
42 {
41 Q_OBJECT
43 Q_OBJECT
42 public:
44 public:
43 explicit ThemeWidget(QWidget *parent = 0);
45 explicit ThemeWidget(QWidget *parent = 0);
44 ~ThemeWidget();
46 ~ThemeWidget();
45
47
46 private Q_SLOTS:
48 private Q_SLOTS:
47 void updateUI();
49 void updateUI();
48
50
49 private:
51 private:
50 DataTable generateRandomData(int listCount, int valueMax, int valueCount) const;
52 DataTable generateRandomData(int listCount, int valueMax, int valueCount) const;
51 QComboBox *createThemeBox() const;
53 QComboBox *createThemeBox() const;
52 QComboBox *createAnimationBox() const;
54 QComboBox *createAnimationBox() const;
53 QComboBox *createLegendBox() const;
55 QComboBox *createLegendBox() const;
54 void connectSignals();
56 void connectSignals();
55 QChart *createAreaChart() const;
57 QChart *createAreaChart() const;
56 QChart *createBarChart(int valueCount) const;
58 QChart *createBarChart(int valueCount) const;
57 QChart *createPieChart() const;
59 QChart *createPieChart() const;
58 QChart *createLineChart() const;
60 QChart *createLineChart() const;
59 QChart *createSplineChart() const;
61 QChart *createSplineChart() const;
60 QChart *createScatterChart() const;
62 QChart *createScatterChart() const;
61
63
62 private:
64 private:
63 int m_listCount;
65 int m_listCount;
64 int m_valueMax;
66 int m_valueMax;
65 int m_valueCount;
67 int m_valueCount;
66 QList<QChartView *> m_charts;
68 QList<QChartView *> m_charts;
67 DataTable m_dataTable;
69 DataTable m_dataTable;
68
70
69 QComboBox *m_themeComboBox;
71 QComboBox *m_themeComboBox;
70 QCheckBox *m_antialiasCheckBox;
72 QCheckBox *m_antialiasCheckBox;
71 QComboBox *m_animatedComboBox;
73 QComboBox *m_animatedComboBox;
72 QComboBox *m_legendComboBox;
74 QComboBox *m_legendComboBox;
73 };
75 };
74
76
75 #endif /* THEMEWIDGET_H */
77 #endif /* THEMEWIDGET_H */
@@ -1,45 +1,47
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18 #ifndef WIDGET_H
18 #ifndef WIDGET_H
19 #define WIDGET_H
19 #define WIDGET_H
20
20
21 #include <QtWidgets/QWidget>
21 #include <QtWidgets/QWidget>
22 #include <QtCharts/QPieSeries>
22 #include <QtCharts/QPieSeries>
23
23
24 QT_BEGIN_NAMESPACE
24 class QTimer;
25 class QTimer;
26 QT_END_NAMESPACE
25
27
26 QT_CHARTS_USE_NAMESPACE
28 QT_CHARTS_USE_NAMESPACE
27
29
28 class Widget : public QWidget
30 class Widget : public QWidget
29 {
31 {
30 Q_OBJECT
32 Q_OBJECT
31
33
32 public:
34 public:
33 Widget(QWidget *parent = 0);
35 Widget(QWidget *parent = 0);
34 ~Widget();
36 ~Widget();
35
37
36 public slots:
38 public slots:
37 void updateRotation();
39 void updateRotation();
38 void explodeSlice(bool exploded);
40 void explodeSlice(bool exploded);
39
41
40 private:
42 private:
41 QList<QPieSeries *> m_donuts;
43 QList<QPieSeries *> m_donuts;
42 QTimer *updateTimer;
44 QTimer *updateTimer;
43 };
45 };
44
46
45 #endif // WIDGET_H
47 #endif // WIDGET_H
@@ -1,51 +1,53
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18 #ifndef BRUSHTOOL_H
18 #ifndef BRUSHTOOL_H
19 #define BRUSHTOOL_H
19 #define BRUSHTOOL_H
20
20
21 #include <QtWidgets/QWidget>
21 #include <QtWidgets/QWidget>
22 #include <QtGui/QBrush>
22 #include <QtGui/QBrush>
23
23
24 QT_BEGIN_NAMESPACE
24 class QPushButton;
25 class QPushButton;
25 class QComboBox;
26 class QComboBox;
27 QT_END_NAMESPACE
26
28
27 class BrushTool : public QWidget
29 class BrushTool : public QWidget
28 {
30 {
29 Q_OBJECT
31 Q_OBJECT
30
32
31 public:
33 public:
32 explicit BrushTool(QString title, QWidget *parent = 0);
34 explicit BrushTool(QString title, QWidget *parent = 0);
33 void setBrush(QBrush brush);
35 void setBrush(QBrush brush);
34 QBrush brush() const;
36 QBrush brush() const;
35 QString name();
37 QString name();
36 static QString name(const QBrush &brush);
38 static QString name(const QBrush &brush);
37
39
38 Q_SIGNALS:
40 Q_SIGNALS:
39 void changed();
41 void changed();
40
42
41 public Q_SLOTS:
43 public Q_SLOTS:
42 void showColorDialog();
44 void showColorDialog();
43 void updateStyle();
45 void updateStyle();
44
46
45 private:
47 private:
46 QBrush m_brush;
48 QBrush m_brush;
47 QPushButton *m_colorButton;
49 QPushButton *m_colorButton;
48 QComboBox *m_styleCombo;
50 QComboBox *m_styleCombo;
49 };
51 };
50
52
51 #endif // BRUSHTOOL_H
53 #endif // BRUSHTOOL_H
@@ -1,91 +1,94
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18 #ifndef MAINWIDGET_H
18 #ifndef MAINWIDGET_H
19 #define MAINWIDGET_H
19 #define MAINWIDGET_H
20
20
21 #include <QtWidgets/QWidget>
21 #include <QtWidgets/QWidget>
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23
23
24 QT_BEGIN_NAMESPACE
24 class QLineEdit;
25 class QLineEdit;
25 class QPushButton;
26 class QPushButton;
26 class QCheckBox;
27 class QCheckBox;
27 class QComboBox;
28 class QComboBox;
28 class QDoubleSpinBox;
29 class QDoubleSpinBox;
30 QT_END_NAMESPACE
31
29 class PenTool;
32 class PenTool;
30 class BrushTool;
33 class BrushTool;
31 class CustomSlice;
34 class CustomSlice;
32
35
33 QT_CHARTS_BEGIN_NAMESPACE
36 QT_CHARTS_BEGIN_NAMESPACE
34 class QChartView;
37 class QChartView;
35 class QPieSeries;
38 class QPieSeries;
36 class QPieSlice;
39 class QPieSlice;
37 QT_CHARTS_END_NAMESPACE
40 QT_CHARTS_END_NAMESPACE
38
41
39 QT_CHARTS_USE_NAMESPACE
42 QT_CHARTS_USE_NAMESPACE
40
43
41 class MainWidget : public QWidget
44 class MainWidget : public QWidget
42 {
45 {
43 Q_OBJECT
46 Q_OBJECT
44
47
45 public:
48 public:
46 explicit MainWidget(QWidget *parent = 0);
49 explicit MainWidget(QWidget *parent = 0);
47
50
48 public Q_SLOTS:
51 public Q_SLOTS:
49 void updateChartSettings();
52 void updateChartSettings();
50 void updateSerieSettings();
53 void updateSerieSettings();
51 void updateSliceSettings();
54 void updateSliceSettings();
52 void handleSliceClicked(QPieSlice *slice);
55 void handleSliceClicked(QPieSlice *slice);
53 void showFontDialog();
56 void showFontDialog();
54 void appendSlice();
57 void appendSlice();
55 void insertSlice();
58 void insertSlice();
56 void removeSlice();
59 void removeSlice();
57
60
58 private:
61 private:
59 QComboBox *m_themeComboBox;
62 QComboBox *m_themeComboBox;
60 QCheckBox *m_aaCheckBox;
63 QCheckBox *m_aaCheckBox;
61 QCheckBox *m_animationsCheckBox;
64 QCheckBox *m_animationsCheckBox;
62 QCheckBox *m_legendCheckBox;
65 QCheckBox *m_legendCheckBox;
63
66
64 QChartView *m_chartView;
67 QChartView *m_chartView;
65 QPieSeries *m_series;
68 QPieSeries *m_series;
66 CustomSlice *m_slice;
69 CustomSlice *m_slice;
67
70
68 QDoubleSpinBox *m_hPosition;
71 QDoubleSpinBox *m_hPosition;
69 QDoubleSpinBox *m_vPosition;
72 QDoubleSpinBox *m_vPosition;
70 QDoubleSpinBox *m_sizeFactor;
73 QDoubleSpinBox *m_sizeFactor;
71 QDoubleSpinBox *m_startAngle;
74 QDoubleSpinBox *m_startAngle;
72 QDoubleSpinBox *m_endAngle;
75 QDoubleSpinBox *m_endAngle;
73 QDoubleSpinBox *m_holeSize;
76 QDoubleSpinBox *m_holeSize;
74
77
75 QLineEdit *m_sliceName;
78 QLineEdit *m_sliceName;
76 QDoubleSpinBox *m_sliceValue;
79 QDoubleSpinBox *m_sliceValue;
77 QCheckBox *m_sliceLabelVisible;
80 QCheckBox *m_sliceLabelVisible;
78 QDoubleSpinBox *m_sliceLabelArmFactor;
81 QDoubleSpinBox *m_sliceLabelArmFactor;
79 QCheckBox *m_sliceExploded;
82 QCheckBox *m_sliceExploded;
80 QDoubleSpinBox *m_sliceExplodedFactor;
83 QDoubleSpinBox *m_sliceExplodedFactor;
81 QPushButton *m_brush;
84 QPushButton *m_brush;
82 BrushTool *m_brushTool;
85 BrushTool *m_brushTool;
83 QPushButton *m_pen;
86 QPushButton *m_pen;
84 PenTool *m_penTool;
87 PenTool *m_penTool;
85 QPushButton *m_font;
88 QPushButton *m_font;
86 QPushButton *m_labelBrush;
89 QPushButton *m_labelBrush;
87 QComboBox *m_labelPosition;
90 QComboBox *m_labelPosition;
88 BrushTool *m_labelBrushTool;
91 BrushTool *m_labelBrushTool;
89 };
92 };
90
93
91 #endif // MAINWIDGET_H
94 #endif // MAINWIDGET_H
@@ -1,58 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18 #ifndef PENTOOL_H
18 #ifndef PENTOOL_H
19 #define PENTOOL_H
19 #define PENTOOL_H
20
20
21 #include <QtWidgets/QWidget>
21 #include <QtWidgets/QWidget>
22 #include <QtGui/QPen>
22 #include <QtGui/QPen>
23
23
24 QT_BEGIN_NAMESPACE
24 class QPushButton;
25 class QPushButton;
25 class QDoubleSpinBox;
26 class QDoubleSpinBox;
26 class QComboBox;
27 class QComboBox;
28 QT_END_NAMESPACE
27
29
28 class PenTool : public QWidget
30 class PenTool : public QWidget
29 {
31 {
30 Q_OBJECT
32 Q_OBJECT
31
33
32 public:
34 public:
33 explicit PenTool(QString title, QWidget *parent = 0);
35 explicit PenTool(QString title, QWidget *parent = 0);
34 void setPen(const QPen &pen);
36 void setPen(const QPen &pen);
35 QPen pen() const;
37 QPen pen() const;
36 QString name();
38 QString name();
37 static QString name(const QPen &pen);
39 static QString name(const QPen &pen);
38
40
39 Q_SIGNALS:
41 Q_SIGNALS:
40 void changed();
42 void changed();
41
43
42 public Q_SLOTS:
44 public Q_SLOTS:
43 void showColorDialog();
45 void showColorDialog();
44 void updateWidth(double width);
46 void updateWidth(double width);
45 void updateStyle(int style);
47 void updateStyle(int style);
46 void updateCapStyle(int index);
48 void updateCapStyle(int index);
47 void updateJoinStyle(int index);
49 void updateJoinStyle(int index);
48
50
49 private:
51 private:
50 QPen m_pen;
52 QPen m_pen;
51 QPushButton *m_colorButton;
53 QPushButton *m_colorButton;
52 QDoubleSpinBox *m_widthSpinBox;
54 QDoubleSpinBox *m_widthSpinBox;
53 QComboBox *m_styleCombo;
55 QComboBox *m_styleCombo;
54 QComboBox *m_capStyleCombo;
56 QComboBox *m_capStyleCombo;
55 QComboBox *m_joinStyleCombo;
57 QComboBox *m_joinStyleCombo;
56 };
58 };
57
59
58 #endif // PENTOOL_H
60 #endif // PENTOOL_H
@@ -1,47 +1,49
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef DATASOURCE_H
19 #ifndef DATASOURCE_H
20 #define DATASOURCE_H
20 #define DATASOURCE_H
21
21
22 #include <QtCore/QObject>
22 #include <QtCore/QObject>
23 #include <QtCharts/QAbstractSeries>
23 #include <QtCharts/QAbstractSeries>
24
24
25 QT_BEGIN_NAMESPACE
25 class QQuickView;
26 class QQuickView;
27 QT_END_NAMESPACE
26
28
27 QT_CHARTS_USE_NAMESPACE
29 QT_CHARTS_USE_NAMESPACE
28
30
29 class DataSource : public QObject
31 class DataSource : public QObject
30 {
32 {
31 Q_OBJECT
33 Q_OBJECT
32 public:
34 public:
33 explicit DataSource(QQuickView *appViewer, QObject *parent = 0);
35 explicit DataSource(QQuickView *appViewer, QObject *parent = 0);
34
36
35 signals:
37 signals:
36
38
37 public slots:
39 public slots:
38 void generateData(int type, int rowCount, int colCount);
40 void generateData(int type, int rowCount, int colCount);
39 void update(QAbstractSeries *series);
41 void update(QAbstractSeries *series);
40
42
41 private:
43 private:
42 QQuickView *m_appViewer;
44 QQuickView *m_appViewer;
43 QList<QList<QPointF> > m_data;
45 QList<QList<QPointF> > m_data;
44 int m_index;
46 int m_index;
45 };
47 };
46
48
47 #endif // DATASOURCE_H
49 #endif // DATASOURCE_H
@@ -1,46 +1,48
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef CHART_H
19 #ifndef CHART_H
20 #define CHART_H
20 #define CHART_H
21
21
22 #include <QtCharts/QChart>
22 #include <QtCharts/QChart>
23
23
24 QT_BEGIN_NAMESPACE
24 class QGestureEvent;
25 class QGestureEvent;
26 QT_END_NAMESPACE
25
27
26 QT_CHARTS_USE_NAMESPACE
28 QT_CHARTS_USE_NAMESPACE
27
29
28 //![1]
30 //![1]
29 class Chart : public QChart
31 class Chart : public QChart
30 //![1]
32 //![1]
31 {
33 {
32 public:
34 public:
33 explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
35 explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
34 ~Chart();
36 ~Chart();
35
37
36 protected:
38 protected:
37 bool sceneEvent(QEvent *event);
39 bool sceneEvent(QEvent *event);
38
40
39 private:
41 private:
40 bool gestureEvent(QGestureEvent *event);
42 bool gestureEvent(QGestureEvent *event);
41
43
42 private:
44 private:
43
45
44 };
46 };
45
47
46 #endif // CHART_H
48 #endif // CHART_H
@@ -1,76 +1,78
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QDATETIMEAXIS_H
19 #ifndef QDATETIMEAXIS_H
20 #define QDATETIMEAXIS_H
20 #define QDATETIMEAXIS_H
21
21
22 #include <QtCharts/QAbstractAxis>
22 #include <QtCharts/QAbstractAxis>
23
23
24 QT_BEGIN_NAMESPACE
24 class QDateTime;
25 class QDateTime;
26 QT_END_NAMESPACE
25
27
26 QT_CHARTS_BEGIN_NAMESPACE
28 QT_CHARTS_BEGIN_NAMESPACE
27
29
28 class QDateTimeAxisPrivate;
30 class QDateTimeAxisPrivate;
29
31
30 class QT_CHARTS_EXPORT QDateTimeAxis : public QAbstractAxis
32 class QT_CHARTS_EXPORT QDateTimeAxis : public QAbstractAxis
31 {
33 {
32 Q_OBJECT
34 Q_OBJECT
33 Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
35 Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
34 Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged)
36 Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged)
35 Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged)
37 Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged)
36 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
38 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
37
39
38 public:
40 public:
39 explicit QDateTimeAxis(QObject *parent = 0);
41 explicit QDateTimeAxis(QObject *parent = 0);
40 ~QDateTimeAxis();
42 ~QDateTimeAxis();
41
43
42 protected:
44 protected:
43 QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent = 0);
45 QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent = 0);
44
46
45 public:
47 public:
46 AxisType type() const;
48 AxisType type() const;
47
49
48 //range handling
50 //range handling
49 void setMin(QDateTime min);
51 void setMin(QDateTime min);
50 QDateTime min() const;
52 QDateTime min() const;
51 void setMax(QDateTime max);
53 void setMax(QDateTime max);
52 QDateTime max() const;
54 QDateTime max() const;
53 void setRange(QDateTime min, QDateTime max);
55 void setRange(QDateTime min, QDateTime max);
54
56
55 void setFormat(QString format);
57 void setFormat(QString format);
56 QString format() const;
58 QString format() const;
57
59
58 //ticks handling
60 //ticks handling
59 void setTickCount(int count);
61 void setTickCount(int count);
60 int tickCount() const;
62 int tickCount() const;
61
63
62 Q_SIGNALS:
64 Q_SIGNALS:
63 void minChanged(QDateTime min);
65 void minChanged(QDateTime min);
64 void maxChanged(QDateTime max);
66 void maxChanged(QDateTime max);
65 void rangeChanged(QDateTime min, QDateTime max);
67 void rangeChanged(QDateTime min, QDateTime max);
66 void formatChanged(QString format);
68 void formatChanged(QString format);
67 void tickCountChanged(int tick);
69 void tickCountChanged(int tick);
68
70
69 private:
71 private:
70 Q_DECLARE_PRIVATE(QDateTimeAxis)
72 Q_DECLARE_PRIVATE(QDateTimeAxis)
71 Q_DISABLE_COPY(QDateTimeAxis)
73 Q_DISABLE_COPY(QDateTimeAxis)
72 };
74 };
73
75
74 QT_CHARTS_END_NAMESPACE
76 QT_CHARTS_END_NAMESPACE
75
77
76 #endif // QDATETIMEAXIS_H
78 #endif // QDATETIMEAXIS_H
@@ -1,75 +1,77
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QLOGVALUEAXIS_H
19 #ifndef QLOGVALUEAXIS_H
20 #define QLOGVALUEAXIS_H
20 #define QLOGVALUEAXIS_H
21
21
22 #include <QtCharts/QAbstractAxis>
22 #include <QtCharts/QAbstractAxis>
23
23
24 QT_BEGIN_NAMESPACE
24 class QDateTime;
25 class QDateTime;
26 QT_END_NAMESPACE
25
27
26 QT_CHARTS_BEGIN_NAMESPACE
28 QT_CHARTS_BEGIN_NAMESPACE
27
29
28 class QLogValueAxisPrivate;
30 class QLogValueAxisPrivate;
29
31
30 class QT_CHARTS_EXPORT QLogValueAxis : public QAbstractAxis
32 class QT_CHARTS_EXPORT QLogValueAxis : public QAbstractAxis
31 {
33 {
32 Q_OBJECT
34 Q_OBJECT
33 Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
35 Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
34 Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
36 Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
35 Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
37 Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
36 Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
38 Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
37
39
38 public:
40 public:
39 explicit QLogValueAxis(QObject *parent = 0);
41 explicit QLogValueAxis(QObject *parent = 0);
40 ~QLogValueAxis();
42 ~QLogValueAxis();
41
43
42 protected:
44 protected:
43 QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = 0);
45 QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = 0);
44
46
45 public:
47 public:
46 AxisType type() const;
48 AxisType type() const;
47
49
48 //range handling
50 //range handling
49 void setMin(qreal min);
51 void setMin(qreal min);
50 qreal min() const;
52 qreal min() const;
51 void setMax(qreal max);
53 void setMax(qreal max);
52 qreal max() const;
54 qreal max() const;
53 void setRange(qreal min, qreal max);
55 void setRange(qreal min, qreal max);
54
56
55 void setLabelFormat(const QString &format);
57 void setLabelFormat(const QString &format);
56 QString labelFormat() const;
58 QString labelFormat() const;
57
59
58 void setBase(qreal base);
60 void setBase(qreal base);
59 qreal base() const;
61 qreal base() const;
60
62
61 Q_SIGNALS:
63 Q_SIGNALS:
62 void minChanged(qreal min);
64 void minChanged(qreal min);
63 void maxChanged(qreal max);
65 void maxChanged(qreal max);
64 void rangeChanged(qreal min, qreal max);
66 void rangeChanged(qreal min, qreal max);
65 void labelFormatChanged(const QString &format);
67 void labelFormatChanged(const QString &format);
66 void baseChanged(qreal base);
68 void baseChanged(qreal base);
67
69
68 private:
70 private:
69 Q_DECLARE_PRIVATE(QLogValueAxis)
71 Q_DECLARE_PRIVATE(QLogValueAxis)
70 Q_DISABLE_COPY(QLogValueAxis)
72 Q_DISABLE_COPY(QLogValueAxis)
71 };
73 };
72
74
73 QT_CHARTS_END_NAMESPACE
75 QT_CHARTS_END_NAMESPACE
74
76
75 #endif // QLOGVALUEAXIS_H
77 #endif // QLOGVALUEAXIS_H
@@ -1,126 +1,128
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTAXIS_P_H
28 #ifndef QABSTRACTAXIS_P_H
29 #define QABSTRACTAXIS_P_H
29 #define QABSTRACTAXIS_P_H
30
30
31 #include <QtCharts/QAbstractAxis>
31 #include <QtCharts/QAbstractAxis>
32 #include <private/chartaxiselement_p.h>
32 #include <private/chartaxiselement_p.h>
33 #include <QtCharts/QChart>
33 #include <QtCharts/QChart>
34 #include <QtCore/QDebug>
34 #include <QtCore/QDebug>
35
35
36 QT_BEGIN_NAMESPACE
36 class QGraphicsItem;
37 class QGraphicsItem;
38 QT_END_NAMESPACE
37
39
38 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
39
41
40 class ChartPresenter;
42 class ChartPresenter;
41 class AbstractDomain;
43 class AbstractDomain;
42 class QChart;
44 class QChart;
43 class QAbstractSeries;
45 class QAbstractSeries;
44 class ChartTheme;
46 class ChartTheme;
45 class ChartElement;
47 class ChartElement;
46
48
47 class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
49 class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
48 {
50 {
49 Q_OBJECT
51 Q_OBJECT
50 public:
52 public:
51 QAbstractAxisPrivate(QAbstractAxis *q);
53 QAbstractAxisPrivate(QAbstractAxis *q);
52 ~QAbstractAxisPrivate();
54 ~QAbstractAxisPrivate();
53
55
54 public:
56 public:
55 Qt::Alignment alignment() const { return m_alignment; }
57 Qt::Alignment alignment() const { return m_alignment; }
56 Qt::Orientation orientation() const { return m_orientation; }
58 Qt::Orientation orientation() const { return m_orientation; }
57 void setAlignment( Qt::Alignment alignment);
59 void setAlignment( Qt::Alignment alignment);
58
60
59 virtual void initializeDomain(AbstractDomain *domain) = 0;
61 virtual void initializeDomain(AbstractDomain *domain) = 0;
60 virtual void initializeGraphics(QGraphicsItem *parent) = 0;
62 virtual void initializeGraphics(QGraphicsItem *parent) = 0;
61 virtual void initializeTheme(ChartTheme* theme, bool forced = false);
63 virtual void initializeTheme(ChartTheme* theme, bool forced = false);
62 virtual void initializeAnimations(QChart::AnimationOptions options);
64 virtual void initializeAnimations(QChart::AnimationOptions options);
63
65
64 //interface for manipulating range form base class
66 //interface for manipulating range form base class
65 virtual void setMin(const QVariant &min) = 0;
67 virtual void setMin(const QVariant &min) = 0;
66 virtual void setMax(const QVariant &max) = 0;
68 virtual void setMax(const QVariant &max) = 0;
67 virtual void setRange(const QVariant &min, const QVariant &max) = 0;
69 virtual void setRange(const QVariant &min, const QVariant &max) = 0;
68
70
69 //interface manipulating range form domain
71 //interface manipulating range form domain
70 virtual void setRange(qreal min, qreal max) = 0;
72 virtual void setRange(qreal min, qreal max) = 0;
71 virtual qreal min() = 0;
73 virtual qreal min() = 0;
72 virtual qreal max() = 0;
74 virtual qreal max() = 0;
73
75
74 ChartAxisElement *axisItem() { return m_item.data(); }
76 ChartAxisElement *axisItem() { return m_item.data(); }
75
77
76 public Q_SLOTS:
78 public Q_SLOTS:
77 void handleRangeChanged(qreal min, qreal max);
79 void handleRangeChanged(qreal min, qreal max);
78
80
79 Q_SIGNALS:
81 Q_SIGNALS:
80 void rangeChanged(qreal min, qreal max);
82 void rangeChanged(qreal min, qreal max);
81
83
82 protected:
84 protected:
83 QAbstractAxis *q_ptr;
85 QAbstractAxis *q_ptr;
84 QChart *m_chart;
86 QChart *m_chart;
85 QScopedPointer<ChartAxisElement> m_item;
87 QScopedPointer<ChartAxisElement> m_item;
86
88
87 private:
89 private:
88 QList<QAbstractSeries*> m_series;
90 QList<QAbstractSeries*> m_series;
89
91
90 Qt::Alignment m_alignment;
92 Qt::Alignment m_alignment;
91 Qt::Orientation m_orientation;
93 Qt::Orientation m_orientation;
92
94
93 bool m_visible;
95 bool m_visible;
94
96
95 bool m_arrowVisible;
97 bool m_arrowVisible;
96 QPen m_axisPen;
98 QPen m_axisPen;
97 QBrush m_axisBrush;
99 QBrush m_axisBrush;
98
100
99 bool m_gridLineVisible;
101 bool m_gridLineVisible;
100 QPen m_gridLinePen;
102 QPen m_gridLinePen;
101
103
102 bool m_labelsVisible;
104 bool m_labelsVisible;
103 QBrush m_labelsBrush;
105 QBrush m_labelsBrush;
104 QFont m_labelsFont;
106 QFont m_labelsFont;
105 int m_labelsAngle;
107 int m_labelsAngle;
106
108
107 bool m_titleVisible;
109 bool m_titleVisible;
108 QBrush m_titleBrush;
110 QBrush m_titleBrush;
109 QFont m_titleFont;
111 QFont m_titleFont;
110 QString m_title;
112 QString m_title;
111
113
112 bool m_shadesVisible;
114 bool m_shadesVisible;
113 QPen m_shadesPen;
115 QPen m_shadesPen;
114 QBrush m_shadesBrush;
116 QBrush m_shadesBrush;
115 qreal m_shadesOpacity;
117 qreal m_shadesOpacity;
116
118
117 bool m_dirty;
119 bool m_dirty;
118
120
119 friend class QAbstractAxis;
121 friend class QAbstractAxis;
120 friend class ChartDataSet;
122 friend class ChartDataSet;
121 friend class ChartPresenter;
123 friend class ChartPresenter;
122 };
124 };
123
125
124 QT_CHARTS_END_NAMESPACE
126 QT_CHARTS_END_NAMESPACE
125
127
126 #endif
128 #endif
@@ -1,67 +1,69
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QBARMODELMAPPER_H
19 #ifndef QBARMODELMAPPER_H
20 #define QBARMODELMAPPER_H
20 #define QBARMODELMAPPER_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCore/QObject>
23 #include <QtCore/QObject>
24
24
25 QT_BEGIN_NAMESPACE
25 class QAbstractItemModel;
26 class QAbstractItemModel;
27 QT_END_NAMESPACE
26
28
27 QT_CHARTS_BEGIN_NAMESPACE
29 QT_CHARTS_BEGIN_NAMESPACE
28
30
29 class QBarModelMapperPrivate;
31 class QBarModelMapperPrivate;
30 class QAbstractBarSeries;
32 class QAbstractBarSeries;
31
33
32 class QT_CHARTS_EXPORT QBarModelMapper : public QObject
34 class QT_CHARTS_EXPORT QBarModelMapper : public QObject
33 {
35 {
34 Q_OBJECT
36 Q_OBJECT
35
37
36 protected:
38 protected:
37 explicit QBarModelMapper(QObject *parent = 0);
39 explicit QBarModelMapper(QObject *parent = 0);
38
40
39 QAbstractItemModel *model() const;
41 QAbstractItemModel *model() const;
40 void setModel(QAbstractItemModel *model);
42 void setModel(QAbstractItemModel *model);
41
43
42 QAbstractBarSeries *series() const;
44 QAbstractBarSeries *series() const;
43 void setSeries(QAbstractBarSeries *series);
45 void setSeries(QAbstractBarSeries *series);
44
46
45 int first() const;
47 int first() const;
46 void setFirst(int first);
48 void setFirst(int first);
47
49
48 int count() const;
50 int count() const;
49 void setCount(int count);
51 void setCount(int count);
50
52
51 int firstBarSetSection() const;
53 int firstBarSetSection() const;
52 void setFirstBarSetSection(int firstBarSetSection);
54 void setFirstBarSetSection(int firstBarSetSection);
53
55
54 int lastBarSetSection() const;
56 int lastBarSetSection() const;
55 void setLastBarSetSection(int lastBarSetSection);
57 void setLastBarSetSection(int lastBarSetSection);
56
58
57 Qt::Orientation orientation() const;
59 Qt::Orientation orientation() const;
58 void setOrientation(Qt::Orientation orientation);
60 void setOrientation(Qt::Orientation orientation);
59
61
60 protected:
62 protected:
61 QBarModelMapperPrivate * const d_ptr;
63 QBarModelMapperPrivate * const d_ptr;
62 Q_DECLARE_PRIVATE(QBarModelMapper)
64 Q_DECLARE_PRIVATE(QBarModelMapper)
63 };
65 };
64
66
65 QT_CHARTS_END_NAMESPACE
67 QT_CHARTS_END_NAMESPACE
66
68
67 #endif // QBARMODELMAPPER_H
69 #endif // QBARMODELMAPPER_H
@@ -1,94 +1,96
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBARMODELMAPPER_P_H
28 #ifndef QBARMODELMAPPER_P_H
29 #define QBARMODELMAPPER_P_H
29 #define QBARMODELMAPPER_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QBarModelMapper>
32 #include <QtCharts/QBarModelMapper>
33
33
34 QT_BEGIN_NAMESPACE
34 class QModelIndex;
35 class QModelIndex;
36 QT_END_NAMESPACE
35
37
36 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
37
39
38 class QBarSet;
40 class QBarSet;
39
41
40 class QBarModelMapperPrivate : public QObject
42 class QBarModelMapperPrivate : public QObject
41 {
43 {
42 Q_OBJECT
44 Q_OBJECT
43 public:
45 public:
44 explicit QBarModelMapperPrivate(QBarModelMapper *q);
46 explicit QBarModelMapperPrivate(QBarModelMapper *q);
45
47
46 public Q_SLOTS:
48 public Q_SLOTS:
47 // for the model
49 // for the model
48 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
49 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
51 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
50 void modelRowsAdded(QModelIndex parent, int start, int end);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
51 void modelRowsRemoved(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
52 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
53 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
54 void handleModelDestroyed();
56 void handleModelDestroyed();
55
57
56 // for the series
58 // for the series
57 void barSetsAdded(QList<QBarSet *> sets);
59 void barSetsAdded(QList<QBarSet *> sets);
58 void barSetsRemoved(QList<QBarSet *> sets);
60 void barSetsRemoved(QList<QBarSet *> sets);
59 void valuesAdded(int index, int count);
61 void valuesAdded(int index, int count);
60 void valuesRemoved(int index, int count);
62 void valuesRemoved(int index, int count);
61 void barLabelChanged();
63 void barLabelChanged();
62 void barValueChanged(int index);
64 void barValueChanged(int index);
63 void handleSeriesDestroyed();
65 void handleSeriesDestroyed();
64
66
65 void initializeBarFromModel();
67 void initializeBarFromModel();
66
68
67 private:
69 private:
68 QBarSet *barSet(QModelIndex index);
70 QBarSet *barSet(QModelIndex index);
69 QModelIndex barModelIndex(int barSection, int posInBar);
71 QModelIndex barModelIndex(int barSection, int posInBar);
70 void insertData(int start, int end);
72 void insertData(int start, int end);
71 void removeData(int start, int end);
73 void removeData(int start, int end);
72 void blockModelSignals(bool block = true);
74 void blockModelSignals(bool block = true);
73 void blockSeriesSignals(bool block = true);
75 void blockSeriesSignals(bool block = true);
74
76
75 private:
77 private:
76 QAbstractBarSeries *m_series;
78 QAbstractBarSeries *m_series;
77 QList<QBarSet *> m_barSets;
79 QList<QBarSet *> m_barSets;
78 QAbstractItemModel *m_model;
80 QAbstractItemModel *m_model;
79 int m_first;
81 int m_first;
80 int m_count;
82 int m_count;
81 Qt::Orientation m_orientation;
83 Qt::Orientation m_orientation;
82 int m_firstBarSetSection;
84 int m_firstBarSetSection;
83 int m_lastBarSetSection;
85 int m_lastBarSetSection;
84 bool m_seriesSignalsBlock;
86 bool m_seriesSignalsBlock;
85 bool m_modelSignalsBlock;
87 bool m_modelSignalsBlock;
86
88
87 private:
89 private:
88 QBarModelMapper *q_ptr;
90 QBarModelMapper *q_ptr;
89 Q_DECLARE_PUBLIC(QBarModelMapper)
91 Q_DECLARE_PUBLIC(QBarModelMapper)
90 };
92 };
91
93
92 QT_CHARTS_END_NAMESPACE
94 QT_CHARTS_END_NAMESPACE
93
95
94 #endif // QBARMODELMAPPER_P_H
96 #endif // QBARMODELMAPPER_P_H
@@ -1,67 +1,69
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QBOXPLOTMODELMAPPER_H
19 #ifndef QBOXPLOTMODELMAPPER_H
20 #define QBOXPLOTMODELMAPPER_H
20 #define QBOXPLOTMODELMAPPER_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCore/QObject>
23 #include <QtCore/QObject>
24
24
25 QT_BEGIN_NAMESPACE
25 class QAbstractItemModel;
26 class QAbstractItemModel;
27 QT_END_NAMESPACE
26
28
27 QT_CHARTS_BEGIN_NAMESPACE
29 QT_CHARTS_BEGIN_NAMESPACE
28
30
29 class QBoxPlotModelMapperPrivate;
31 class QBoxPlotModelMapperPrivate;
30 class QBoxPlotSeries;
32 class QBoxPlotSeries;
31
33
32 class QT_CHARTS_EXPORT QBoxPlotModelMapper : public QObject
34 class QT_CHARTS_EXPORT QBoxPlotModelMapper : public QObject
33 {
35 {
34 Q_OBJECT
36 Q_OBJECT
35
37
36 protected:
38 protected:
37 explicit QBoxPlotModelMapper(QObject *parent = 0);
39 explicit QBoxPlotModelMapper(QObject *parent = 0);
38
40
39 QAbstractItemModel *model() const;
41 QAbstractItemModel *model() const;
40 void setModel(QAbstractItemModel *model);
42 void setModel(QAbstractItemModel *model);
41
43
42 QBoxPlotSeries *series() const;
44 QBoxPlotSeries *series() const;
43 void setSeries(QBoxPlotSeries *series);
45 void setSeries(QBoxPlotSeries *series);
44
46
45 int first() const;
47 int first() const;
46 void setFirst(int first);
48 void setFirst(int first);
47
49
48 int count() const;
50 int count() const;
49 void setCount(int count);
51 void setCount(int count);
50
52
51 int firstBoxSetSection() const;
53 int firstBoxSetSection() const;
52 void setFirstBoxSetSection(int firstBoxSetSection);
54 void setFirstBoxSetSection(int firstBoxSetSection);
53
55
54 int lastBoxSetSection() const;
56 int lastBoxSetSection() const;
55 void setLastBoxSetSection(int lastBoxSetSection);
57 void setLastBoxSetSection(int lastBoxSetSection);
56
58
57 Qt::Orientation orientation() const;
59 Qt::Orientation orientation() const;
58 void setOrientation(Qt::Orientation orientation);
60 void setOrientation(Qt::Orientation orientation);
59
61
60 protected:
62 protected:
61 QBoxPlotModelMapperPrivate * const d_ptr;
63 QBoxPlotModelMapperPrivate * const d_ptr;
62 Q_DECLARE_PRIVATE(QBoxPlotModelMapper)
64 Q_DECLARE_PRIVATE(QBoxPlotModelMapper)
63 };
65 };
64
66
65 QT_CHARTS_END_NAMESPACE
67 QT_CHARTS_END_NAMESPACE
66
68
67 #endif // QBOXPLOTMODELMAPPER_H
69 #endif // QBOXPLOTMODELMAPPER_H
@@ -1,91 +1,93
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QBOXPLOTMODELMAPPER_P_H
28 #ifndef QBOXPLOTMODELMAPPER_P_H
29 #define QBOXPLOTMODELMAPPER_P_H
29 #define QBOXPLOTMODELMAPPER_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QBoxPlotModelMapper>
32 #include <QtCharts/QBoxPlotModelMapper>
33
33
34 QT_BEGIN_NAMESPACE
34 class QModelIndex;
35 class QModelIndex;
36 QT_END_NAMESPACE
35
37
36 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
37
39
38 class QBoxSet;
40 class QBoxSet;
39
41
40 class QBoxPlotModelMapperPrivate : public QObject
42 class QBoxPlotModelMapperPrivate : public QObject
41 {
43 {
42 Q_OBJECT
44 Q_OBJECT
43 public:
45 public:
44 explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
46 explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
45
47
46 public Q_SLOTS:
48 public Q_SLOTS:
47 // for the model
49 // for the model
48 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
50 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
49 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
51 void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
50 void modelRowsAdded(QModelIndex parent, int start, int end);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
51 void modelRowsRemoved(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
52 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
53 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
54 void handleModelDestroyed();
56 void handleModelDestroyed();
55
57
56 // for the series
58 // for the series
57 void boxSetsAdded(QList<QBoxSet *> sets);
59 void boxSetsAdded(QList<QBoxSet *> sets);
58 void boxSetsRemoved(QList<QBoxSet *> sets);
60 void boxSetsRemoved(QList<QBoxSet *> sets);
59 void boxValueChanged(int index);
61 void boxValueChanged(int index);
60 void handleSeriesDestroyed();
62 void handleSeriesDestroyed();
61
63
62 void initializeBoxFromModel();
64 void initializeBoxFromModel();
63
65
64 private:
66 private:
65 QBoxSet *boxSet(QModelIndex index);
67 QBoxSet *boxSet(QModelIndex index);
66 QModelIndex boxModelIndex(int boxSection, int posInBox);
68 QModelIndex boxModelIndex(int boxSection, int posInBox);
67 void insertData(int start, int end);
69 void insertData(int start, int end);
68 void removeData(int start, int end);
70 void removeData(int start, int end);
69 void blockModelSignals(bool block = true);
71 void blockModelSignals(bool block = true);
70 void blockSeriesSignals(bool block = true);
72 void blockSeriesSignals(bool block = true);
71
73
72 private:
74 private:
73 QBoxPlotSeries *m_series;
75 QBoxPlotSeries *m_series;
74 QList<QBoxSet *> m_boxSets;
76 QList<QBoxSet *> m_boxSets;
75 QAbstractItemModel *m_model;
77 QAbstractItemModel *m_model;
76 int m_first;
78 int m_first;
77 int m_count;
79 int m_count;
78 Qt::Orientation m_orientation;
80 Qt::Orientation m_orientation;
79 int m_firstBoxSetSection;
81 int m_firstBoxSetSection;
80 int m_lastBoxSetSection;
82 int m_lastBoxSetSection;
81 bool m_seriesSignalsBlock;
83 bool m_seriesSignalsBlock;
82 bool m_modelSignalsBlock;
84 bool m_modelSignalsBlock;
83
85
84 private:
86 private:
85 QBoxPlotModelMapper *q_ptr;
87 QBoxPlotModelMapper *q_ptr;
86 Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
88 Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
87 };
89 };
88
90
89 QT_CHARTS_END_NAMESPACE
91 QT_CHARTS_END_NAMESPACE
90
92
91 #endif // QBOXPLOTMODELMAPPER_P_H
93 #endif // QBOXPLOTMODELMAPPER_P_H
@@ -1,60 +1,63
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTBACKGROUND_H
28 #ifndef CHARTBACKGROUND_H
29 #define CHARTBACKGROUND_H
29 #define CHARTBACKGROUND_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtWidgets/QGraphicsRectItem>
32 #include <QtWidgets/QGraphicsRectItem>
33
33
34 QT_BEGIN_NAMESPACE
34 class QGraphicsDropShadowEffect;
35 class QGraphicsDropShadowEffect;
36 QT_END_NAMESPACE
37
35 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
36
39
37 class ChartBackground: public QGraphicsRectItem
40 class ChartBackground: public QGraphicsRectItem
38 {
41 {
39 public:
42 public:
40 ChartBackground(QGraphicsItem *parent = 0);
43 ChartBackground(QGraphicsItem *parent = 0);
41 ~ChartBackground();
44 ~ChartBackground();
42
45
43 void setDiameter(qreal diameter);
46 void setDiameter(qreal diameter);
44 qreal diameter() const;
47 qreal diameter() const;
45 void setDropShadowEnabled(bool enabled);
48 void setDropShadowEnabled(bool enabled);
46 bool isDropShadowEnabled() { return m_dropShadow != 0; }
49 bool isDropShadowEnabled() { return m_dropShadow != 0; }
47
50
48 protected:
51 protected:
49 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
52 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
50
53
51 private:
54 private:
52 qreal m_diameter;
55 qreal m_diameter;
53 QGraphicsDropShadowEffect *m_dropShadow;
56 QGraphicsDropShadowEffect *m_dropShadow;
54 };
57 };
55
58
56 QT_CHARTS_END_NAMESPACE
59 QT_CHARTS_END_NAMESPACE
57
60
58 #endif /* CHARTBACKGROUND_H */
61 #endif /* CHARTBACKGROUND_H */
59
62
60
63
@@ -1,84 +1,87
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef PIECHARTITEM_H
28 #ifndef PIECHARTITEM_H
29 #define PIECHARTITEM_H
29 #define PIECHARTITEM_H
30
30
31 #include <QtCharts/QPieSeries>
31 #include <QtCharts/QPieSeries>
32 #include <private/chartitem_p.h>
32 #include <private/chartitem_p.h>
33 #include <private/piesliceitem_p.h>
33 #include <private/piesliceitem_p.h>
34 #include <QtCore/QPointer>
34 #include <QtCore/QPointer>
35
35
36 QT_BEGIN_NAMESPACE
36 class QGraphicsItem;
37 class QGraphicsItem;
38 QT_END_NAMESPACE
39
37 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
38 class QPieSlice;
41 class QPieSlice;
39 class ChartPresenter;
42 class ChartPresenter;
40 class PieAnimation;
43 class PieAnimation;
41
44
42 class PieChartItem : public ChartItem
45 class PieChartItem : public ChartItem
43 {
46 {
44 Q_OBJECT
47 Q_OBJECT
45
48
46 public:
49 public:
47 explicit PieChartItem(QPieSeries *series, QGraphicsItem* item = 0);
50 explicit PieChartItem(QPieSeries *series, QGraphicsItem* item = 0);
48 ~PieChartItem();
51 ~PieChartItem();
49
52
50 // from QGraphicsItem
53 // from QGraphicsItem
51 QRectF boundingRect() const { return m_rect; }
54 QRectF boundingRect() const { return m_rect; }
52 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
55 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
53
56
54 public Q_SLOTS:
57 public Q_SLOTS:
55 // from Chart
58 // from Chart
56 virtual void handleDomainUpdated();
59 virtual void handleDomainUpdated();
57
60
58 void updateLayout();
61 void updateLayout();
59 void handleSlicesAdded(QList<QPieSlice *> slices);
62 void handleSlicesAdded(QList<QPieSlice *> slices);
60 void handleSlicesRemoved(QList<QPieSlice *> slices);
63 void handleSlicesRemoved(QList<QPieSlice *> slices);
61 void handleSliceChanged();
64 void handleSliceChanged();
62 void handleSeriesVisibleChanged();
65 void handleSeriesVisibleChanged();
63 void handleOpacityChanged();
66 void handleOpacityChanged();
64
67
65 void setAnimation(PieAnimation *animation);
68 void setAnimation(PieAnimation *animation);
66 ChartAnimation *animation() const;
69 ChartAnimation *animation() const;
67
70
68 private:
71 private:
69 PieSliceData updateSliceGeometry(QPieSlice *slice);
72 PieSliceData updateSliceGeometry(QPieSlice *slice);
70
73
71 private:
74 private:
72 QHash<QPieSlice *, PieSliceItem *> m_sliceItems;
75 QHash<QPieSlice *, PieSliceItem *> m_sliceItems;
73 QPointer<QPieSeries> m_series;
76 QPointer<QPieSeries> m_series;
74 QRectF m_rect;
77 QRectF m_rect;
75 QPointF m_pieCenter;
78 QPointF m_pieCenter;
76 qreal m_pieRadius;
79 qreal m_pieRadius;
77 qreal m_holeSize;
80 qreal m_holeSize;
78 PieAnimation *m_animation;
81 PieAnimation *m_animation;
79
82
80 };
83 };
81
84
82 QT_CHARTS_END_NAMESPACE
85 QT_CHARTS_END_NAMESPACE
83
86
84 #endif // PIECHARTITEM_H
87 #endif // PIECHARTITEM_H
@@ -1,67 +1,69
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QPIEMODELMAPPER_H
19 #ifndef QPIEMODELMAPPER_H
20 #define QPIEMODELMAPPER_H
20 #define QPIEMODELMAPPER_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCore/QObject>
23 #include <QtCore/QObject>
24
24
25 QT_BEGIN_NAMESPACE
25 class QAbstractItemModel;
26 class QAbstractItemModel;
27 QT_END_NAMESPACE
26
28
27 QT_CHARTS_BEGIN_NAMESPACE
29 QT_CHARTS_BEGIN_NAMESPACE
28
30
29 class QPieModelMapperPrivate;
31 class QPieModelMapperPrivate;
30 class QPieSeries;
32 class QPieSeries;
31
33
32 class QT_CHARTS_EXPORT QPieModelMapper : public QObject
34 class QT_CHARTS_EXPORT QPieModelMapper : public QObject
33 {
35 {
34 Q_OBJECT
36 Q_OBJECT
35
37
36 protected:
38 protected:
37 explicit QPieModelMapper(QObject *parent = 0);
39 explicit QPieModelMapper(QObject *parent = 0);
38
40
39 QAbstractItemModel *model() const;
41 QAbstractItemModel *model() const;
40 void setModel(QAbstractItemModel *model);
42 void setModel(QAbstractItemModel *model);
41
43
42 QPieSeries *series() const;
44 QPieSeries *series() const;
43 void setSeries(QPieSeries *series);
45 void setSeries(QPieSeries *series);
44
46
45 int first() const;
47 int first() const;
46 void setFirst(int first);
48 void setFirst(int first);
47
49
48 int count() const;
50 int count() const;
49 void setCount(int count);
51 void setCount(int count);
50
52
51 int valuesSection() const;
53 int valuesSection() const;
52 void setValuesSection(int valuesSection);
54 void setValuesSection(int valuesSection);
53
55
54 int labelsSection() const;
56 int labelsSection() const;
55 void setLabelsSection(int labelsSection);
57 void setLabelsSection(int labelsSection);
56
58
57 Qt::Orientation orientation() const;
59 Qt::Orientation orientation() const;
58 void setOrientation(Qt::Orientation orientation);
60 void setOrientation(Qt::Orientation orientation);
59
61
60 protected:
62 protected:
61 QPieModelMapperPrivate * const d_ptr;
63 QPieModelMapperPrivate * const d_ptr;
62 Q_DECLARE_PRIVATE(QPieModelMapper)
64 Q_DECLARE_PRIVATE(QPieModelMapper)
63 };
65 };
64
66
65 QT_CHARTS_END_NAMESPACE
67 QT_CHARTS_END_NAMESPACE
66
68
67 #endif // QPIEMODELMAPPER_H
69 #endif // QPIEMODELMAPPER_H
@@ -1,97 +1,99
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QPIEMODELMAPPER_P_H
28 #ifndef QPIEMODELMAPPER_P_H
29 #define QPIEMODELMAPPER_P_H
29 #define QPIEMODELMAPPER_P_H
30
30
31 #include <QtCore/QObject>
31 #include <QtCore/QObject>
32 #include <QtCharts/QPieModelMapper>
32 #include <QtCharts/QPieModelMapper>
33
33
34 QT_BEGIN_NAMESPACE
34 class QModelIndex;
35 class QModelIndex;
36 QT_END_NAMESPACE
35
37
36 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
37
39
38 class QPieSlice;
40 class QPieSlice;
39
41
40 class QPieModelMapperPrivate : public QObject
42 class QPieModelMapperPrivate : public QObject
41 {
43 {
42 Q_OBJECT
44 Q_OBJECT
43
45
44 public:
46 public:
45 explicit QPieModelMapperPrivate(QPieModelMapper *q);
47 explicit QPieModelMapperPrivate(QPieModelMapper *q);
46
48
47 public Q_SLOTS:
49 public Q_SLOTS:
48 // for the model
50 // for the model
49 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
51 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
50 void modelRowsAdded(QModelIndex parent, int start, int end);
52 void modelRowsAdded(QModelIndex parent, int start, int end);
51 void modelRowsRemoved(QModelIndex parent, int start, int end);
53 void modelRowsRemoved(QModelIndex parent, int start, int end);
52 void modelColumnsAdded(QModelIndex parent, int start, int end);
54 void modelColumnsAdded(QModelIndex parent, int start, int end);
53 void modelColumnsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsRemoved(QModelIndex parent, int start, int end);
54 void handleModelDestroyed();
56 void handleModelDestroyed();
55
57
56 // for the series
58 // for the series
57 void slicesAdded(QList<QPieSlice *> slices);
59 void slicesAdded(QList<QPieSlice *> slices);
58 void slicesRemoved(QList<QPieSlice *> slices);
60 void slicesRemoved(QList<QPieSlice *> slices);
59 void sliceLabelChanged();
61 void sliceLabelChanged();
60 void sliceValueChanged();
62 void sliceValueChanged();
61 void handleSeriesDestroyed();
63 void handleSeriesDestroyed();
62
64
63 void initializePieFromModel();
65 void initializePieFromModel();
64
66
65 private:
67 private:
66 QPieSlice *pieSlice(QModelIndex index) const;
68 QPieSlice *pieSlice(QModelIndex index) const;
67 bool isLabelIndex(QModelIndex index) const;
69 bool isLabelIndex(QModelIndex index) const;
68 bool isValueIndex(QModelIndex index) const;
70 bool isValueIndex(QModelIndex index) const;
69 QModelIndex valueModelIndex(int slicePos);
71 QModelIndex valueModelIndex(int slicePos);
70 QModelIndex labelModelIndex(int slicePos);
72 QModelIndex labelModelIndex(int slicePos);
71 void insertData(int start, int end);
73 void insertData(int start, int end);
72 void removeData(int start, int end);
74 void removeData(int start, int end);
73
75
74 void blockModelSignals(bool block = true);
76 void blockModelSignals(bool block = true);
75 void blockSeriesSignals(bool block = true);
77 void blockSeriesSignals(bool block = true);
76
78
77 private:
79 private:
78 QPieSeries *m_series;
80 QPieSeries *m_series;
79 QList<QPieSlice *> m_slices;
81 QList<QPieSlice *> m_slices;
80 QAbstractItemModel *m_model;
82 QAbstractItemModel *m_model;
81 int m_first;
83 int m_first;
82 int m_count;
84 int m_count;
83 Qt::Orientation m_orientation;
85 Qt::Orientation m_orientation;
84 int m_valuesSection;
86 int m_valuesSection;
85 int m_labelsSection;
87 int m_labelsSection;
86 bool m_seriesSignalsBlock;
88 bool m_seriesSignalsBlock;
87 bool m_modelSignalsBlock;
89 bool m_modelSignalsBlock;
88
90
89 private:
91 private:
90
92
91 QPieModelMapper *q_ptr;
93 QPieModelMapper *q_ptr;
92 Q_DECLARE_PUBLIC(QPieModelMapper)
94 Q_DECLARE_PUBLIC(QPieModelMapper)
93 };
95 };
94
96
95 QT_CHARTS_END_NAMESPACE
97 QT_CHARTS_END_NAMESPACE
96
98
97 #endif // QPIEMODELMAPPER_P_H
99 #endif // QPIEMODELMAPPER_P_H
@@ -1,103 +1,105
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTSERIES_P_H
28 #ifndef QABSTRACTSERIES_P_H
29 #define QABSTRACTSERIES_P_H
29 #define QABSTRACTSERIES_P_H
30
30
31 #include <QtCharts/QAbstractSeries>
31 #include <QtCharts/QAbstractSeries>
32 #include <QtCharts/QChart>
32 #include <QtCharts/QChart>
33 #include <private/abstractdomain_p.h>
33 #include <private/abstractdomain_p.h>
34
34
35 QT_BEGIN_NAMESPACE
35 class QGraphicsItem;
36 class QGraphicsItem;
37 QT_END_NAMESPACE
36
38
37 QT_CHARTS_BEGIN_NAMESPACE
39 QT_CHARTS_BEGIN_NAMESPACE
38
40
39 class ChartPresenter;
41 class ChartPresenter;
40 class ChartElement;
42 class ChartElement;
41 class LegendMarker;
43 class LegendMarker;
42 class QLegend;
44 class QLegend;
43 class ChartDataSet;
45 class ChartDataSet;
44 class QAbstractAxis;
46 class QAbstractAxis;
45 class QLegendMarker;
47 class QLegendMarker;
46 class ChartTheme;
48 class ChartTheme;
47 class ChartAnimation;
49 class ChartAnimation;
48 class ChartItem;
50 class ChartItem;
49 class BoxPlotChartItem;
51 class BoxPlotChartItem;
50
52
51 class QAbstractSeriesPrivate : public QObject
53 class QAbstractSeriesPrivate : public QObject
52 {
54 {
53 Q_OBJECT
55 Q_OBJECT
54 public:
56 public:
55 QAbstractSeriesPrivate(QAbstractSeries *q);
57 QAbstractSeriesPrivate(QAbstractSeries *q);
56 ~QAbstractSeriesPrivate();
58 ~QAbstractSeriesPrivate();
57
59
58 virtual void initializeDomain() = 0;
60 virtual void initializeDomain() = 0;
59 virtual void initializeAxes() = 0;
61 virtual void initializeAxes() = 0;
60 virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
62 virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
61 virtual void initializeGraphics(QGraphicsItem* parent) = 0;
63 virtual void initializeGraphics(QGraphicsItem* parent) = 0;
62 virtual void initializeAnimations(QChart::AnimationOptions options) = 0;
64 virtual void initializeAnimations(QChart::AnimationOptions options) = 0;
63
65
64 virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
66 virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
65
67
66 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
68 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
67 virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
69 virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
68
70
69 ChartItem* chartItem() { return m_item.data(); }
71 ChartItem* chartItem() { return m_item.data(); }
70
72
71 virtual void setDomain(AbstractDomain* domain);
73 virtual void setDomain(AbstractDomain* domain);
72 AbstractDomain* domain() { return m_domain.data(); }
74 AbstractDomain* domain() { return m_domain.data(); }
73
75
74 virtual void setPresenter(ChartPresenter *presenter);
76 virtual void setPresenter(ChartPresenter *presenter);
75 ChartPresenter *presenter() const;
77 ChartPresenter *presenter() const;
76
78
77 QChart* chart() { return m_chart; }
79 QChart* chart() { return m_chart; }
78
80
79 Q_SIGNALS:
81 Q_SIGNALS:
80 void countChanged();
82 void countChanged();
81
83
82 protected:
84 protected:
83 QAbstractSeries *q_ptr;
85 QAbstractSeries *q_ptr;
84 QChart *m_chart;
86 QChart *m_chart;
85 QScopedPointer<ChartItem> m_item;
87 QScopedPointer<ChartItem> m_item;
86 QList<QAbstractAxis*> m_axes;
88 QList<QAbstractAxis*> m_axes;
87 private:
89 private:
88 QScopedPointer<AbstractDomain> m_domain;
90 QScopedPointer<AbstractDomain> m_domain;
89 QString m_name;
91 QString m_name;
90 bool m_visible;
92 bool m_visible;
91 qreal m_opacity;
93 qreal m_opacity;
92 ChartPresenter *m_presenter;
94 ChartPresenter *m_presenter;
93
95
94 friend class QAbstractSeries;
96 friend class QAbstractSeries;
95 friend class ChartDataSet;
97 friend class ChartDataSet;
96 friend class ChartPresenter;
98 friend class ChartPresenter;
97 friend class QLegendPrivate;
99 friend class QLegendPrivate;
98 friend class BoxPlotChartItem;
100 friend class BoxPlotChartItem;
99 };
101 };
100
102
101 QT_CHARTS_END_NAMESPACE
103 QT_CHARTS_END_NAMESPACE
102
104
103 #endif
105 #endif
@@ -1,183 +1,185
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QCHART_H
19 #ifndef QCHART_H
20 #define QCHART_H
20 #define QCHART_H
21
21
22 #include <QtCharts/QAbstractSeries>
22 #include <QtCharts/QAbstractSeries>
23 #include <QtCharts/QLegend>
23 #include <QtCharts/QLegend>
24 #include <QtWidgets/QGraphicsWidget>
24 #include <QtWidgets/QGraphicsWidget>
25 #include <QtCore/QMargins>
25 #include <QtCore/QMargins>
26
26
27 QT_BEGIN_NAMESPACE
27 class QGraphicsSceneResizeEvent;
28 class QGraphicsSceneResizeEvent;
29 QT_END_NAMESPACE
28
30
29 QT_CHARTS_BEGIN_NAMESPACE
31 QT_CHARTS_BEGIN_NAMESPACE
30
32
31 class QAbstractSeries;
33 class QAbstractSeries;
32 class QAbstractAxis;
34 class QAbstractAxis;
33 class QLegend;
35 class QLegend;
34 class QChartPrivate;
36 class QChartPrivate;
35 class QBoxPlotSeries;
37 class QBoxPlotSeries;
36
38
37 class QT_CHARTS_EXPORT QChart : public QGraphicsWidget
39 class QT_CHARTS_EXPORT QChart : public QGraphicsWidget
38 {
40 {
39 Q_OBJECT
41 Q_OBJECT
40 Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme)
42 Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme)
41 Q_PROPERTY(QString title READ title WRITE setTitle)
43 Q_PROPERTY(QString title READ title WRITE setTitle)
42 Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible)
44 Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible)
43 Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled)
45 Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled)
44 Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness)
46 Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness)
45 Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions)
47 Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions)
46 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
48 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
47 Q_PROPERTY(QChart::ChartType chartType READ chartType)
49 Q_PROPERTY(QChart::ChartType chartType READ chartType)
48 Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible)
50 Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible)
49 Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers)
51 Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers)
50 Q_PROPERTY(QLocale locale READ locale WRITE setLocale)
52 Q_PROPERTY(QLocale locale READ locale WRITE setLocale)
51 Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged)
53 Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged)
52 Q_ENUMS(ChartTheme)
54 Q_ENUMS(ChartTheme)
53 Q_ENUMS(AnimationOption)
55 Q_ENUMS(AnimationOption)
54 Q_ENUMS(ChartType)
56 Q_ENUMS(ChartType)
55
57
56 public:
58 public:
57 enum ChartType {
59 enum ChartType {
58 ChartTypeUndefined = 0,
60 ChartTypeUndefined = 0,
59 ChartTypeCartesian,
61 ChartTypeCartesian,
60 ChartTypePolar
62 ChartTypePolar
61 };
63 };
62
64
63 enum ChartTheme {
65 enum ChartTheme {
64 ChartThemeLight = 0,
66 ChartThemeLight = 0,
65 ChartThemeBlueCerulean,
67 ChartThemeBlueCerulean,
66 ChartThemeDark,
68 ChartThemeDark,
67 ChartThemeBrownSand,
69 ChartThemeBrownSand,
68 ChartThemeBlueNcs,
70 ChartThemeBlueNcs,
69 ChartThemeHighContrast,
71 ChartThemeHighContrast,
70 ChartThemeBlueIcy,
72 ChartThemeBlueIcy,
71 ChartThemeQt
73 ChartThemeQt
72 };
74 };
73
75
74 enum AnimationOption {
76 enum AnimationOption {
75 NoAnimation = 0x0,
77 NoAnimation = 0x0,
76 GridAxisAnimations = 0x1,
78 GridAxisAnimations = 0x1,
77 SeriesAnimations = 0x2,
79 SeriesAnimations = 0x2,
78 AllAnimations = 0x3
80 AllAnimations = 0x3
79 };
81 };
80
82
81 Q_DECLARE_FLAGS(AnimationOptions, AnimationOption)
83 Q_DECLARE_FLAGS(AnimationOptions, AnimationOption)
82
84
83 public:
85 public:
84 explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
86 explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
85 ~QChart();
87 ~QChart();
86
88
87 void addSeries(QAbstractSeries *series);
89 void addSeries(QAbstractSeries *series);
88 void removeSeries(QAbstractSeries *series);
90 void removeSeries(QAbstractSeries *series);
89 void removeAllSeries();
91 void removeAllSeries();
90 QList<QAbstractSeries *> series() const;
92 QList<QAbstractSeries *> series() const;
91
93
92 // *** deprecated ***
94 // *** deprecated ***
93 void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
95 void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
94 void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
96 void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
95 QAbstractAxis *axisX(QAbstractSeries *series = 0) const;
97 QAbstractAxis *axisX(QAbstractSeries *series = 0) const;
96 QAbstractAxis *axisY(QAbstractSeries *series = 0) const;
98 QAbstractAxis *axisY(QAbstractSeries *series = 0) const;
97 // ******************
99 // ******************
98
100
99 void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
101 void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
100 void removeAxis(QAbstractAxis *axis);
102 void removeAxis(QAbstractAxis *axis);
101 QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const;
103 QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const;
102
104
103 void createDefaultAxes();
105 void createDefaultAxes();
104
106
105 void setTheme(QChart::ChartTheme theme);
107 void setTheme(QChart::ChartTheme theme);
106 QChart::ChartTheme theme() const;
108 QChart::ChartTheme theme() const;
107
109
108 void setTitle(const QString &title);
110 void setTitle(const QString &title);
109 QString title() const;
111 QString title() const;
110 void setTitleFont(const QFont &font);
112 void setTitleFont(const QFont &font);
111 QFont titleFont() const;
113 QFont titleFont() const;
112 void setTitleBrush(const QBrush &brush);
114 void setTitleBrush(const QBrush &brush);
113 QBrush titleBrush() const;
115 QBrush titleBrush() const;
114
116
115 void setBackgroundBrush(const QBrush &brush);
117 void setBackgroundBrush(const QBrush &brush);
116 QBrush backgroundBrush() const;
118 QBrush backgroundBrush() const;
117 void setBackgroundPen(const QPen &pen);
119 void setBackgroundPen(const QPen &pen);
118 QPen backgroundPen() const;
120 QPen backgroundPen() const;
119 void setBackgroundVisible(bool visible = true);
121 void setBackgroundVisible(bool visible = true);
120 bool isBackgroundVisible() const;
122 bool isBackgroundVisible() const;
121
123
122 void setDropShadowEnabled(bool enabled = true);
124 void setDropShadowEnabled(bool enabled = true);
123 bool isDropShadowEnabled() const;
125 bool isDropShadowEnabled() const;
124 void setBackgroundRoundness(qreal diameter);
126 void setBackgroundRoundness(qreal diameter);
125 qreal backgroundRoundness() const;
127 qreal backgroundRoundness() const;
126 void setAnimationOptions(AnimationOptions options);
128 void setAnimationOptions(AnimationOptions options);
127 AnimationOptions animationOptions() const;
129 AnimationOptions animationOptions() const;
128
130
129 void zoomIn();
131 void zoomIn();
130 void zoomOut();
132 void zoomOut();
131
133
132 void zoomIn(const QRectF &rect);
134 void zoomIn(const QRectF &rect);
133 void zoom(qreal factor);
135 void zoom(qreal factor);
134 void zoomReset();
136 void zoomReset();
135 bool isZoomed();
137 bool isZoomed();
136
138
137 void scroll(qreal dx, qreal dy);
139 void scroll(qreal dx, qreal dy);
138
140
139 QLegend *legend() const;
141 QLegend *legend() const;
140
142
141 void setMargins(const QMargins &margins);
143 void setMargins(const QMargins &margins);
142 QMargins margins() const;
144 QMargins margins() const;
143
145
144 QRectF plotArea() const;
146 QRectF plotArea() const;
145 void setPlotAreaBackgroundBrush(const QBrush &brush);
147 void setPlotAreaBackgroundBrush(const QBrush &brush);
146 QBrush plotAreaBackgroundBrush() const;
148 QBrush plotAreaBackgroundBrush() const;
147 void setPlotAreaBackgroundPen(const QPen &pen);
149 void setPlotAreaBackgroundPen(const QPen &pen);
148 QPen plotAreaBackgroundPen() const;
150 QPen plotAreaBackgroundPen() const;
149 void setPlotAreaBackgroundVisible(bool visible = true);
151 void setPlotAreaBackgroundVisible(bool visible = true);
150 bool isPlotAreaBackgroundVisible() const;
152 bool isPlotAreaBackgroundVisible() const;
151 void setLocalizeNumbers(bool localize);
153 void setLocalizeNumbers(bool localize);
152 bool localizeNumbers() const;
154 bool localizeNumbers() const;
153 void setLocale(const QLocale &locale);
155 void setLocale(const QLocale &locale);
154 QLocale locale() const;
156 QLocale locale() const;
155
157
156 QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
158 QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
157 QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
159 QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
158
160
159 ChartType chartType() const;
161 ChartType chartType() const;
160
162
161 signals:
163 signals:
162 void plotAreaChanged(const QRectF &plotArea);
164 void plotAreaChanged(const QRectF &plotArea);
163
165
164 protected:
166 protected:
165 explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags);
167 explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags);
166 QScopedPointer<QChartPrivate> d_ptr;
168 QScopedPointer<QChartPrivate> d_ptr;
167 friend class QLegend;
169 friend class QLegend;
168 friend class DeclarativeChart;
170 friend class DeclarativeChart;
169 friend class ChartDataSet;
171 friend class ChartDataSet;
170 friend class ChartPresenter;
172 friend class ChartPresenter;
171 friend class ChartThemeManager;
173 friend class ChartThemeManager;
172 friend class QAbstractSeries;
174 friend class QAbstractSeries;
173 friend class QBoxPlotSeriesPrivate;
175 friend class QBoxPlotSeriesPrivate;
174
176
175 private:
177 private:
176 Q_DISABLE_COPY(QChart)
178 Q_DISABLE_COPY(QChart)
177 };
179 };
178
180
179 QT_CHARTS_END_NAMESPACE
181 QT_CHARTS_END_NAMESPACE
180
182
181 Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions)
183 Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions)
182
184
183 #endif // QCHART_H
185 #endif // QCHART_H
@@ -1,73 +1,75
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QCHARTVIEW_H
19 #ifndef QCHARTVIEW_H
20 #define QCHARTVIEW_H
20 #define QCHARTVIEW_H
21
21
22 #include <QtCharts/QAbstractAxis>
22 #include <QtCharts/QAbstractAxis>
23 #include <QtCharts/QAbstractSeries>
23 #include <QtCharts/QAbstractSeries>
24 #include <QtCharts/QChart>
24 #include <QtCharts/QChart>
25 #include <QtWidgets/QGraphicsView>
25 #include <QtWidgets/QGraphicsView>
26
26
27 QT_BEGIN_NAMESPACE
27 class QGraphicsScene;
28 class QGraphicsScene;
28 class QRubberBand;
29 class QRubberBand;
30 QT_END_NAMESPACE
29
31
30 QT_CHARTS_BEGIN_NAMESPACE
32 QT_CHARTS_BEGIN_NAMESPACE
31
33
32 class QChartViewPrivate;
34 class QChartViewPrivate;
33
35
34 class QT_CHARTS_EXPORT QChartView : public QGraphicsView
36 class QT_CHARTS_EXPORT QChartView : public QGraphicsView
35 {
37 {
36 Q_OBJECT
38 Q_OBJECT
37 Q_ENUMS(RubberBand)
39 Q_ENUMS(RubberBand)
38 public:
40 public:
39
41
40 enum RubberBand {
42 enum RubberBand {
41 NoRubberBand = 0x0,
43 NoRubberBand = 0x0,
42 VerticalRubberBand = 0x1,
44 VerticalRubberBand = 0x1,
43 HorizontalRubberBand = 0x2,
45 HorizontalRubberBand = 0x2,
44 RectangleRubberBand = 0x3
46 RectangleRubberBand = 0x3
45 };
47 };
46
48
47 Q_DECLARE_FLAGS(RubberBands, RubberBand)
49 Q_DECLARE_FLAGS(RubberBands, RubberBand)
48
50
49 explicit QChartView(QWidget *parent = 0);
51 explicit QChartView(QWidget *parent = 0);
50 explicit QChartView(QChart *chart, QWidget *parent = 0);
52 explicit QChartView(QChart *chart, QWidget *parent = 0);
51 ~QChartView();
53 ~QChartView();
52
54
53 void setRubberBand(const RubberBands &rubberBands);
55 void setRubberBand(const RubberBands &rubberBands);
54 RubberBands rubberBand() const;
56 RubberBands rubberBand() const;
55
57
56 QChart *chart() const;
58 QChart *chart() const;
57 void setChart(QChart *chart);
59 void setChart(QChart *chart);
58
60
59 protected:
61 protected:
60 void resizeEvent(QResizeEvent *event);
62 void resizeEvent(QResizeEvent *event);
61 void mousePressEvent(QMouseEvent *event);
63 void mousePressEvent(QMouseEvent *event);
62 void mouseMoveEvent(QMouseEvent *event);
64 void mouseMoveEvent(QMouseEvent *event);
63 void mouseReleaseEvent(QMouseEvent *event);
65 void mouseReleaseEvent(QMouseEvent *event);
64
66
65 QScopedPointer<QChartViewPrivate> d_ptr;
67 QScopedPointer<QChartViewPrivate> d_ptr;
66
68
67 private:
69 private:
68 Q_DISABLE_COPY(QChartView)
70 Q_DISABLE_COPY(QChartView)
69 };
71 };
70
72
71 QT_CHARTS_END_NAMESPACE
73 QT_CHARTS_END_NAMESPACE
72
74
73 #endif // QCHARTVIEW_H
75 #endif // QCHARTVIEW_H
@@ -1,63 +1,65
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QCHARTVIEW_P_H
28 #ifndef QCHARTVIEW_P_H
29 #define QCHARTVIEW_P_H
29 #define QCHARTVIEW_P_H
30
30
31 #include <QtCharts/QChartView>
31 #include <QtCharts/QChartView>
32
32
33 QT_BEGIN_NAMESPACE
33 class QGraphicsScene;
34 class QGraphicsScene;
34 class ChartPresenter;
35 QT_END_NAMESPACE
35
36
36 QT_CHARTS_BEGIN_NAMESPACE
37 QT_CHARTS_BEGIN_NAMESPACE
37
38
38 class QChart;
39 class QChart;
40 class ChartPresenter;
39 class QChartView;
41 class QChartView;
40
42
41 class QChartViewPrivate
43 class QChartViewPrivate
42 {
44 {
43 public:
45 public:
44 explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
46 explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
45 ~QChartViewPrivate();
47 ~QChartViewPrivate();
46 void setChart(QChart *chart);
48 void setChart(QChart *chart);
47 void resize();
49 void resize();
48
50
49 protected:
51 protected:
50 QChartView *q_ptr;
52 QChartView *q_ptr;
51
53
52 public:
54 public:
53 QGraphicsScene *m_scene;
55 QGraphicsScene *m_scene;
54 QChart *m_chart;
56 QChart *m_chart;
55 QPoint m_rubberBandOrigin;
57 QPoint m_rubberBandOrigin;
56 #ifndef QT_NO_RUBBERBAND
58 #ifndef QT_NO_RUBBERBAND
57 QRubberBand *m_rubberBand;
59 QRubberBand *m_rubberBand;
58 #endif
60 #endif
59 QChartView::RubberBands m_rubberBandFlags;
61 QChartView::RubberBands m_rubberBandFlags;
60 };
62 };
61
63
62 QT_CHARTS_END_NAMESPACE
64 QT_CHARTS_END_NAMESPACE
63 #endif
65 #endif
@@ -1,108 +1,110
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef SCROLLER_P_H
28 #ifndef SCROLLER_P_H
29 #define SCROLLER_P_H
29 #define SCROLLER_P_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <QtCore/QObject>
32 #include <QtCore/QObject>
33 #include <QtCore/QBasicTimer>
33 #include <QtCore/QBasicTimer>
34 #include <QtCore/QTime>
34 #include <QtCore/QTime>
35 #include <QtCore/QPointF>
35 #include <QtCore/QPointF>
36
36
37 QT_BEGIN_NAMESPACE
37 class QGraphicsSceneMouseEvent;
38 class QGraphicsSceneMouseEvent;
39 QT_END_NAMESPACE
38
40
39 QT_CHARTS_BEGIN_NAMESPACE
41 QT_CHARTS_BEGIN_NAMESPACE
40
42
41 class Scroller;
43 class Scroller;
42 class QLegend;
44 class QLegend;
43
45
44 class ScrollTicker : public QObject
46 class ScrollTicker : public QObject
45 {
47 {
46 Q_OBJECT
48 Q_OBJECT
47 public:
49 public:
48 explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
50 explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
49 void start(int interval);
51 void start(int interval);
50 void stop();
52 void stop();
51 protected:
53 protected:
52 void timerEvent(QTimerEvent *event);
54 void timerEvent(QTimerEvent *event);
53
55
54 private:
56 private:
55 QBasicTimer m_timer;
57 QBasicTimer m_timer;
56 Scroller *m_scroller;
58 Scroller *m_scroller;
57 };
59 };
58
60
59 class Scroller
61 class Scroller
60 {
62 {
61 public:
63 public:
62 enum State {
64 enum State {
63 Idle,
65 Idle,
64 Pressed,
66 Pressed,
65 Move,
67 Move,
66 Scroll
68 Scroll
67 };
69 };
68
70
69 Scroller();
71 Scroller();
70 virtual ~Scroller();
72 virtual ~Scroller();
71
73
72 virtual void setOffset(const QPointF &point) = 0;
74 virtual void setOffset(const QPointF &point) = 0;
73 virtual QPointF offset() const = 0;
75 virtual QPointF offset() const = 0;
74
76
75 void move(const QPointF &delta);
77 void move(const QPointF &delta);
76 void scrollTo(const QPointF &delta);
78 void scrollTo(const QPointF &delta);
77
79
78 void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
80 void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
79 void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
81 void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
80 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
82 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
81
83
82 void scrollTick();
84 void scrollTick();
83
85
84 private:
86 private:
85 void startTicker(int interval);
87 void startTicker(int interval);
86 void stopTicker();
88 void stopTicker();
87
89
88 private:
90 private:
89 void calculateSpeed(const QPointF &position);
91 void calculateSpeed(const QPointF &position);
90 void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
92 void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
91
93
92 private:
94 private:
93 ScrollTicker m_ticker;
95 ScrollTicker m_ticker;
94 QTime m_timeStamp;
96 QTime m_timeStamp;
95 QPointF m_speed;
97 QPointF m_speed;
96 QPointF m_fraction;
98 QPointF m_fraction;
97 int m_timeTresholdMin;
99 int m_timeTresholdMin;
98 int m_timeTresholdMax;
100 int m_timeTresholdMax;
99
101
100 State m_state;
102 State m_state;
101 QPointF m_pressPos;
103 QPointF m_pressPos;
102 QPointF m_lastPos;
104 QPointF m_lastPos;
103 qreal m_treshold;
105 qreal m_treshold;
104 };
106 };
105
107
106 QT_CHARTS_END_NAMESPACE
108 QT_CHARTS_END_NAMESPACE
107
109
108 #endif /* SCROLLER_P_H */
110 #endif /* SCROLLER_P_H */
@@ -1,67 +1,69
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QXYMODELMAPPER_H
19 #ifndef QXYMODELMAPPER_H
20 #define QXYMODELMAPPER_H
20 #define QXYMODELMAPPER_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCore/QObject>
23 #include <QtCore/QObject>
24
24
25 QT_BEGIN_NAMESPACE
25 class QAbstractItemModel;
26 class QAbstractItemModel;
27 QT_END_NAMESPACE
26
28
27 QT_CHARTS_BEGIN_NAMESPACE
29 QT_CHARTS_BEGIN_NAMESPACE
28
30
29 class QXYModelMapperPrivate;
31 class QXYModelMapperPrivate;
30 class QXYSeries;
32 class QXYSeries;
31
33
32 class QT_CHARTS_EXPORT QXYModelMapper : public QObject
34 class QT_CHARTS_EXPORT QXYModelMapper : public QObject
33 {
35 {
34 Q_OBJECT
36 Q_OBJECT
35
37
36 protected:
38 protected:
37 explicit QXYModelMapper(QObject *parent = 0);
39 explicit QXYModelMapper(QObject *parent = 0);
38
40
39 QAbstractItemModel *model() const;
41 QAbstractItemModel *model() const;
40 void setModel(QAbstractItemModel *model);
42 void setModel(QAbstractItemModel *model);
41
43
42 QXYSeries *series() const;
44 QXYSeries *series() const;
43 void setSeries(QXYSeries *series);
45 void setSeries(QXYSeries *series);
44
46
45 int first() const;
47 int first() const;
46 void setFirst(int first);
48 void setFirst(int first);
47
49
48 int count() const;
50 int count() const;
49 void setCount(int count);
51 void setCount(int count);
50
52
51 Qt::Orientation orientation() const;
53 Qt::Orientation orientation() const;
52 void setOrientation(Qt::Orientation orientation);
54 void setOrientation(Qt::Orientation orientation);
53
55
54 int xSection() const;
56 int xSection() const;
55 void setXSection(int xSection);
57 void setXSection(int xSection);
56
58
57 int ySection() const;
59 int ySection() const;
58 void setYSection(int ySection);
60 void setYSection(int ySection);
59
61
60 protected:
62 protected:
61 QXYModelMapperPrivate *const d_ptr;
63 QXYModelMapperPrivate *const d_ptr;
62 Q_DECLARE_PRIVATE(QXYModelMapper)
64 Q_DECLARE_PRIVATE(QXYModelMapper)
63 };
65 };
64
66
65 QT_CHARTS_END_NAMESPACE
67 QT_CHARTS_END_NAMESPACE
66
68
67 #endif // QXYMODELMAPPER_H
69 #endif // QXYMODELMAPPER_H
@@ -1,95 +1,97
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QXYMODELMAPPER_P_H
28 #ifndef QXYMODELMAPPER_P_H
29 #define QXYMODELMAPPER_P_H
29 #define QXYMODELMAPPER_P_H
30
30
31 #include <QtCharts/QXYModelMapper>
31 #include <QtCharts/QXYModelMapper>
32 #include <QtCore/QObject>
32 #include <QtCore/QObject>
33
33
34 QT_BEGIN_NAMESPACE
34 class QModelIndex;
35 class QModelIndex;
35 class QAbstractItemModel;
36 class QAbstractItemModel;
36 class QPointF;
37 class QPointF;
38 QT_END_NAMESPACE
37
39
38 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
39
41
40 class QXYModelMapper;
42 class QXYModelMapper;
41 class QXYSeries;
43 class QXYSeries;
42
44
43 class QXYModelMapperPrivate : public QObject
45 class QXYModelMapperPrivate : public QObject
44 {
46 {
45 Q_OBJECT
47 Q_OBJECT
46
48
47 public:
49 public:
48 QXYModelMapperPrivate(QXYModelMapper *q);
50 QXYModelMapperPrivate(QXYModelMapper *q);
49
51
50 public Q_SLOTS:
52 public Q_SLOTS:
51 // for the model
53 // for the model
52 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
54 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
53 void modelRowsAdded(QModelIndex parent, int start, int end);
55 void modelRowsAdded(QModelIndex parent, int start, int end);
54 void modelRowsRemoved(QModelIndex parent, int start, int end);
56 void modelRowsRemoved(QModelIndex parent, int start, int end);
55 void modelColumnsAdded(QModelIndex parent, int start, int end);
57 void modelColumnsAdded(QModelIndex parent, int start, int end);
56 void modelColumnsRemoved(QModelIndex parent, int start, int end);
58 void modelColumnsRemoved(QModelIndex parent, int start, int end);
57 void handleModelDestroyed();
59 void handleModelDestroyed();
58
60
59 // for the series
61 // for the series
60 void handlePointAdded(int pointPos);
62 void handlePointAdded(int pointPos);
61 void handlePointRemoved(int pointPos);
63 void handlePointRemoved(int pointPos);
62 void handlePointReplaced(int pointPos);
64 void handlePointReplaced(int pointPos);
63 void handleSeriesDestroyed();
65 void handleSeriesDestroyed();
64
66
65 void initializeXYFromModel();
67 void initializeXYFromModel();
66
68
67 private:
69 private:
68 QModelIndex xModelIndex(int xPos);
70 QModelIndex xModelIndex(int xPos);
69 QModelIndex yModelIndex(int yPos);
71 QModelIndex yModelIndex(int yPos);
70 void insertData(int start, int end);
72 void insertData(int start, int end);
71 void removeData(int start, int end);
73 void removeData(int start, int end);
72 void blockModelSignals(bool block = true);
74 void blockModelSignals(bool block = true);
73 void blockSeriesSignals(bool block = true);
75 void blockSeriesSignals(bool block = true);
74 qreal valueFromModel(QModelIndex index);
76 qreal valueFromModel(QModelIndex index);
75 void setValueToModel(QModelIndex index, qreal value);
77 void setValueToModel(QModelIndex index, qreal value);
76
78
77 private:
79 private:
78 QXYSeries *m_series;
80 QXYSeries *m_series;
79 QAbstractItemModel *m_model;
81 QAbstractItemModel *m_model;
80 int m_first;
82 int m_first;
81 int m_count;
83 int m_count;
82 Qt::Orientation m_orientation;
84 Qt::Orientation m_orientation;
83 int m_xSection;
85 int m_xSection;
84 int m_ySection;
86 int m_ySection;
85 bool m_seriesSignalsBlock;
87 bool m_seriesSignalsBlock;
86 bool m_modelSignalsBlock;
88 bool m_modelSignalsBlock;
87
89
88 private:
90 private:
89 QXYModelMapper *q_ptr;
91 QXYModelMapper *q_ptr;
90 Q_DECLARE_PUBLIC(QXYModelMapper)
92 Q_DECLARE_PUBLIC(QXYModelMapper)
91 };
93 };
92
94
93 QT_CHARTS_END_NAMESPACE
95 QT_CHARTS_END_NAMESPACE
94
96
95 #endif // QXYMODELMAPPER_P_H
97 #endif // QXYMODELMAPPER_P_H
@@ -1,121 +1,123
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QXYSERIES_H
19 #ifndef QXYSERIES_H
20 #define QXYSERIES_H
20 #define QXYSERIES_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCharts/QAbstractSeries>
23 #include <QtCharts/QAbstractSeries>
24 #include <QtGui/QPen>
24 #include <QtGui/QPen>
25 #include <QtGui/QBrush>
25 #include <QtGui/QBrush>
26
26
27 QT_BEGIN_NAMESPACE
27 class QModelIndex;
28 class QModelIndex;
29 QT_END_NAMESPACE
28
30
29 QT_CHARTS_BEGIN_NAMESPACE
31 QT_CHARTS_BEGIN_NAMESPACE
30
32
31 class QXYSeriesPrivate;
33 class QXYSeriesPrivate;
32 class QXYModelMapper;
34 class QXYModelMapper;
33
35
34 class QT_CHARTS_EXPORT QXYSeries : public QAbstractSeries
36 class QT_CHARTS_EXPORT QXYSeries : public QAbstractSeries
35 {
37 {
36 Q_OBJECT
38 Q_OBJECT
37 Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
39 Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
38 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
40 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
39 Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged)
41 Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged)
40 Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged)
42 Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged)
41 Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged)
43 Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged)
42 Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged)
44 Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged)
43
45
44 protected:
46 protected:
45 explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0);
47 explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0);
46
48
47 public:
49 public:
48 ~QXYSeries();
50 ~QXYSeries();
49 void append(qreal x, qreal y);
51 void append(qreal x, qreal y);
50 void append(const QPointF &point);
52 void append(const QPointF &point);
51 void append(const QList<QPointF> &points);
53 void append(const QList<QPointF> &points);
52 void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
54 void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
53 void replace(const QPointF &oldPoint, const QPointF &newPoint);
55 void replace(const QPointF &oldPoint, const QPointF &newPoint);
54 void replace(int index, qreal newX, qreal newY);
56 void replace(int index, qreal newX, qreal newY);
55 void replace(int index, const QPointF &newPoint);
57 void replace(int index, const QPointF &newPoint);
56 void remove(qreal x, qreal y);
58 void remove(qreal x, qreal y);
57 void remove(const QPointF &point);
59 void remove(const QPointF &point);
58 void remove(int index);
60 void remove(int index);
59 void insert(int index, const QPointF &point);
61 void insert(int index, const QPointF &point);
60 void clear();
62 void clear();
61
63
62 int count() const;
64 int count() const;
63 QList<QPointF> points() const;
65 QList<QPointF> points() const;
64 const QPointF &at(int index) const;
66 const QPointF &at(int index) const;
65
67
66 QXYSeries &operator << (const QPointF &point);
68 QXYSeries &operator << (const QPointF &point);
67 QXYSeries &operator << (const QList<QPointF> &points);
69 QXYSeries &operator << (const QList<QPointF> &points);
68
70
69 virtual void setPen(const QPen &pen);
71 virtual void setPen(const QPen &pen);
70 QPen pen() const;
72 QPen pen() const;
71
73
72 virtual void setBrush(const QBrush &brush);
74 virtual void setBrush(const QBrush &brush);
73 QBrush brush() const;
75 QBrush brush() const;
74
76
75 virtual void setColor(const QColor &color);
77 virtual void setColor(const QColor &color);
76 virtual QColor color() const;
78 virtual QColor color() const;
77
79
78 void setPointsVisible(bool visible = true);
80 void setPointsVisible(bool visible = true);
79 bool pointsVisible() const;
81 bool pointsVisible() const;
80
82
81 void setPointLabelsFormat(const QString &format);
83 void setPointLabelsFormat(const QString &format);
82 QString pointLabelsFormat() const;
84 QString pointLabelsFormat() const;
83
85
84 void setPointLabelsVisible(bool visible = true);
86 void setPointLabelsVisible(bool visible = true);
85 bool pointLabelsVisible() const;
87 bool pointLabelsVisible() const;
86
88
87 void setPointLabelsFont(const QFont &font);
89 void setPointLabelsFont(const QFont &font);
88 QFont pointLabelsFont() const;
90 QFont pointLabelsFont() const;
89
91
90 void setPointLabelsColor(const QColor &color);
92 void setPointLabelsColor(const QColor &color);
91 QColor pointLabelsColor() const;
93 QColor pointLabelsColor() const;
92
94
93 void replace(QList<QPointF> points);
95 void replace(QList<QPointF> points);
94
96
95 Q_SIGNALS:
97 Q_SIGNALS:
96 void clicked(const QPointF &point);
98 void clicked(const QPointF &point);
97 void hovered(const QPointF &point, bool state);
99 void hovered(const QPointF &point, bool state);
98 void pressed(const QPointF &point);
100 void pressed(const QPointF &point);
99 void released(const QPointF &point);
101 void released(const QPointF &point);
100 void doubleClicked(const QPointF &point);
102 void doubleClicked(const QPointF &point);
101 void pointReplaced(int index);
103 void pointReplaced(int index);
102 void pointRemoved(int index);
104 void pointRemoved(int index);
103 void pointAdded(int index);
105 void pointAdded(int index);
104 void colorChanged(QColor color);
106 void colorChanged(QColor color);
105 void pointsReplaced();
107 void pointsReplaced();
106 void pointLabelsFormatChanged(const QString &format);
108 void pointLabelsFormatChanged(const QString &format);
107 void pointLabelsVisibilityChanged(bool visible);
109 void pointLabelsVisibilityChanged(bool visible);
108 void pointLabelsFontChanged(const QFont &font);
110 void pointLabelsFontChanged(const QFont &font);
109 void pointLabelsColorChanged(const QColor &color);
111 void pointLabelsColorChanged(const QColor &color);
110
112
111 private:
113 private:
112 Q_DECLARE_PRIVATE(QXYSeries)
114 Q_DECLARE_PRIVATE(QXYSeries)
113 Q_DISABLE_COPY(QXYSeries)
115 Q_DISABLE_COPY(QXYSeries)
114 friend class QXYLegendMarkerPrivate;
116 friend class QXYLegendMarkerPrivate;
115 friend class XYLegendMarker;
117 friend class XYLegendMarker;
116 friend class XYChart;
118 friend class XYChart;
117 };
119 };
118
120
119 QT_CHARTS_END_NAMESPACE
121 QT_CHARTS_END_NAMESPACE
120
122
121 #endif // QXYSERIES_H
123 #endif // QXYSERIES_H
@@ -1,96 +1,98
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef TST_DEFINITIONS_H
19 #ifndef TST_DEFINITIONS_H
20 #define TST_DEFINITIONS_H
20 #define TST_DEFINITIONS_H
21
21
22 #include <QtCharts/qpolarchart.h>
22 #include <QtCharts/qpolarchart.h>
23 #include <QtTest/QtTest>
23 #include <QtTest/QtTest>
24 #include <QtWidgets/QPushButton>
24 #include <QtWidgets/QPushButton>
25
25
26 QT_BEGIN_NAMESPACE
26 namespace QTest
27 namespace QTest
27 {
28 {
28 // This was deprecated in Qt5. This is a small hack for the sake of compatibility.
29 // This was deprecated in Qt5. This is a small hack for the sake of compatibility.
29 inline static bool qWaitForWindowShown(QWidget *window)
30 inline static bool qWaitForWindowShown(QWidget *window)
30 {
31 {
31 return QTest::qWaitForWindowExposed(window);
32 return QTest::qWaitForWindowExposed(window);
32 }
33 }
33 }
34 }
35 QT_END_NAMESPACE
34
36
35 #define TRY_COMPARE(actual, expected) { \
37 #define TRY_COMPARE(actual, expected) { \
36 do { \
38 do { \
37 const int timeout(1000); \
39 const int timeout(1000); \
38 const int waitStep(30); \
40 const int waitStep(30); \
39 /* always wait before comparing to catch possible extra signals */ \
41 /* always wait before comparing to catch possible extra signals */ \
40 QTest::qWait(waitStep); \
42 QTest::qWait(waitStep); \
41 for (int time(0); (actual != expected) && (time < timeout); time += waitStep) \
43 for (int time(0); (actual != expected) && (time < timeout); time += waitStep) \
42 QTest::qWait(waitStep); \
44 QTest::qWait(waitStep); \
43 QCOMPARE(actual, expected); \
45 QCOMPARE(actual, expected); \
44 } while (0); \
46 } while (0); \
45 }
47 }
46
48
47 // Some bamboo clients have trouble passing mouse events to the test application.
49 // Some bamboo clients have trouble passing mouse events to the test application.
48 // This can be used to skip those tests so that they don't show up as a failure
50 // This can be used to skip those tests so that they don't show up as a failure
49 // in the test report.
51 // in the test report.
50 #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \
52 #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \
51 do { \
53 do { \
52 QPushButton b; \
54 QPushButton b; \
53 b.resize(100, 100); \
55 b.resize(100, 100); \
54 b.show(); \
56 b.show(); \
55 QTest::qWaitForWindowShown(&b); \
57 QTest::qWaitForWindowShown(&b); \
56 QSignalSpy spy(&b, SIGNAL(clicked())); \
58 QSignalSpy spy(&b, SIGNAL(clicked())); \
57 QTest::mouseClick(&b, Qt::LeftButton, 0, b.rect().center()); \
59 QTest::mouseClick(&b, Qt::LeftButton, 0, b.rect().center()); \
58 if (spy.count() == 0) \
60 if (spy.count() == 0) \
59 QSKIP("Cannot test mouse events in this environment"); \
61 QSKIP("Cannot test mouse events in this environment"); \
60 } while (0); \
62 } while (0); \
61 }
63 }
62
64
63 #define SKIP_ON_POLAR() { \
65 #define SKIP_ON_POLAR() { \
64 if (isPolarTest()) \
66 if (isPolarTest()) \
65 QSKIP("Test not supported by polar chart"); \
67 QSKIP("Test not supported by polar chart"); \
66 }
68 }
67
69
68 #define SKIP_ON_CARTESIAN() { \
70 #define SKIP_ON_CARTESIAN() { \
69 if (!isPolarTest()) \
71 if (!isPolarTest()) \
70 QSKIP("Test not supported by cartesian chart"); \
72 QSKIP("Test not supported by cartesian chart"); \
71 }
73 }
72
74
73 static inline bool isPolarTest()
75 static inline bool isPolarTest()
74 {
76 {
75 static bool isPolar = false;
77 static bool isPolar = false;
76 static bool polarEnvChecked = false;
78 static bool polarEnvChecked = false;
77 if (!polarEnvChecked) {
79 if (!polarEnvChecked) {
78 isPolar = !(qgetenv("TEST_POLAR_CHART").isEmpty());
80 isPolar = !(qgetenv("TEST_POLAR_CHART").isEmpty());
79 polarEnvChecked = true;
81 polarEnvChecked = true;
80 if (isPolar)
82 if (isPolar)
81 qDebug() << "TEST_POLAR_CHART found -> Testing polar chart!";
83 qDebug() << "TEST_POLAR_CHART found -> Testing polar chart!";
82 }
84 }
83 return isPolar;
85 return isPolar;
84 }
86 }
85
87
86 static inline QtCharts::QChart *newQChartOrQPolarChart()
88 static inline QtCharts::QChart *newQChartOrQPolarChart()
87 {
89 {
88 if (isPolarTest())
90 if (isPolarTest())
89 return new QtCharts::QPolarChart();
91 return new QtCharts::QPolarChart();
90 else
92 else
91 return new QtCharts::QChart();
93 return new QtCharts::QChart();
92 }
94 }
93
95
94
96
95
97
96 #endif // TST_DEFINITIONS_H
98 #endif // TST_DEFINITIONS_H
@@ -1,94 +1,97
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef MAINWIDGET_H
19 #ifndef MAINWIDGET_H
20 #define MAINWIDGET_H
20 #define MAINWIDGET_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCharts/QChart>
23 #include <QtCharts/QChart>
24 #include <QtCharts/QChartView>
24 #include <QtCharts/QChartView>
25 #include <QtWidgets/QWidget>
25 #include <QtWidgets/QWidget>
26 #include <QtCharts/QBoxPlotSeries>
26 #include <QtCharts/QBoxPlotSeries>
27 #include <QtCharts/QBarCategoryAxis>
27 #include <QtCharts/QBarCategoryAxis>
28 #include <QtCharts/QBoxSet>
28 #include <QtCharts/QBoxSet>
29 #include <QtWidgets/QCheckBox>
29 #include <QtWidgets/QCheckBox>
30 #include <QtWidgets/QDoubleSpinBox>
30 #include <QtWidgets/QDoubleSpinBox>
31
31
32 QT_BEGIN_NAMESPACE
32 class QGridLayout;
33 class QGridLayout;
34 QT_END_NAMESPACE
35
33 class CustomTableModel;
36 class CustomTableModel;
34 class PenTool;
37 class PenTool;
35
38
36 QT_CHARTS_USE_NAMESPACE
39 QT_CHARTS_USE_NAMESPACE
37
40
38 class MainWidget : public QWidget
41 class MainWidget : public QWidget
39 {
42 {
40 Q_OBJECT
43 Q_OBJECT
41 public:
44 public:
42 explicit MainWidget(QWidget *parent = 0);
45 explicit MainWidget(QWidget *parent = 0);
43
46
44 signals:
47 signals:
45
48
46 private:
49 private:
47 void initThemeCombo(QGridLayout *grid);
50 void initThemeCombo(QGridLayout *grid);
48 void initCheckboxes(QGridLayout *grid);
51 void initCheckboxes(QGridLayout *grid);
49 void updateAxis(int categoryCount);
52 void updateAxis(int categoryCount);
50
53
51 private slots:
54 private slots:
52 void addSeries();
55 void addSeries();
53 void removeSeries();
56 void removeSeries();
54 void addBox();
57 void addBox();
55 void insertBox();
58 void insertBox();
56 void removeBox();
59 void removeBox();
57 void clear();
60 void clear();
58 void clearBox();
61 void clearBox();
59 void setBrush();
62 void setBrush();
60 void animationToggled(bool enabled);
63 void animationToggled(bool enabled);
61 void legendToggled(bool enabled);
64 void legendToggled(bool enabled);
62 void titleToggled(bool enabled);
65 void titleToggled(bool enabled);
63 void modelMapperToggled(bool enabled);
66 void modelMapperToggled(bool enabled);
64 void changeChartTheme(int themeIndex);
67 void changeChartTheme(int themeIndex);
65 void boxClicked(QBoxSet *set);
68 void boxClicked(QBoxSet *set);
66 void boxHovered(bool state, QBoxSet *set);
69 void boxHovered(bool state, QBoxSet *set);
67 void boxPressed(QBoxSet *set);
70 void boxPressed(QBoxSet *set);
68 void boxReleased(QBoxSet *set);
71 void boxReleased(QBoxSet *set);
69 void boxDoubleClicked(QBoxSet *set);
72 void boxDoubleClicked(QBoxSet *set);
70 void singleBoxClicked();
73 void singleBoxClicked();
71 void singleBoxHovered(bool state);
74 void singleBoxHovered(bool state);
72 void singleBoxPressed();
75 void singleBoxPressed();
73 void singleBoxReleased();
76 void singleBoxReleased();
74 void singleBoxDoubleClicked();
77 void singleBoxDoubleClicked();
75 void changePen();
78 void changePen();
76 void antialiasingToggled(bool);
79 void antialiasingToggled(bool);
77 void boxOutlineToggled(bool);
80 void boxOutlineToggled(bool);
78 void setBoxWidth(double width);
81 void setBoxWidth(double width);
79
82
80 private:
83 private:
81 QChart *m_chart;
84 QChart *m_chart;
82 QChartView *m_chartView;
85 QChartView *m_chartView;
83 QGridLayout *m_scatterLayout;
86 QGridLayout *m_scatterLayout;
84 QBarCategoryAxis *m_axis;
87 QBarCategoryAxis *m_axis;
85 CustomTableModel *m_model;
88 CustomTableModel *m_model;
86 PenTool *m_penTool;
89 PenTool *m_penTool;
87 int m_rowPos;
90 int m_rowPos;
88 int m_seriesCount;
91 int m_seriesCount;
89 QBoxPlotSeries *m_series[10];
92 QBoxPlotSeries *m_series[10];
90 QCheckBox *m_boxOutlined;
93 QCheckBox *m_boxOutlined;
91 QDoubleSpinBox *m_boxWidthSB;
94 QDoubleSpinBox *m_boxWidthSB;
92 };
95 };
93
96
94 #endif // MAINWIDGET_H
97 #endif // MAINWIDGET_H
@@ -1,58 +1,60
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18 #ifndef PENTOOL_H
18 #ifndef PENTOOL_H
19 #define PENTOOL_H
19 #define PENTOOL_H
20
20
21 #include <QtWidgets/QWidget>
21 #include <QtWidgets/QWidget>
22 #include <QtGui/QPen>
22 #include <QtGui/QPen>
23
23
24 QT_BEGIN_NAMESPACE
24 class QPushButton;
25 class QPushButton;
25 class QDoubleSpinBox;
26 class QDoubleSpinBox;
26 class QComboBox;
27 class QComboBox;
28 QT_END_NAMESPACE
27
29
28 class PenTool : public QWidget
30 class PenTool : public QWidget
29 {
31 {
30 Q_OBJECT
32 Q_OBJECT
31
33
32 public:
34 public:
33 explicit PenTool(QString title, QWidget *parent = 0);
35 explicit PenTool(QString title, QWidget *parent = 0);
34 void setPen(const QPen &pen);
36 void setPen(const QPen &pen);
35 QPen pen() const;
37 QPen pen() const;
36 QString name();
38 QString name();
37 static QString name(const QPen &pen);
39 static QString name(const QPen &pen);
38
40
39 Q_SIGNALS:
41 Q_SIGNALS:
40 void changed();
42 void changed();
41
43
42 public Q_SLOTS:
44 public Q_SLOTS:
43 void showColorDialog();
45 void showColorDialog();
44 void updateWidth(double width);
46 void updateWidth(double width);
45 void updateStyle(int style);
47 void updateStyle(int style);
46 void updateCapStyle(int index);
48 void updateCapStyle(int index);
47 void updateJoinStyle(int index);
49 void updateJoinStyle(int index);
48
50
49 private:
51 private:
50 QPen m_pen;
52 QPen m_pen;
51 QPushButton *m_colorButton;
53 QPushButton *m_colorButton;
52 QDoubleSpinBox *m_widthSpinBox;
54 QDoubleSpinBox *m_widthSpinBox;
53 QComboBox *m_styleCombo;
55 QComboBox *m_styleCombo;
54 QComboBox *m_capStyleCombo;
56 QComboBox *m_capStyleCombo;
55 QComboBox *m_joinStyleCombo;
57 QComboBox *m_joinStyleCombo;
56 };
58 };
57
59
58 #endif // PENTOOL_H
60 #endif // PENTOOL_H
@@ -1,80 +1,83
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef GRID_H_
19 #ifndef GRID_H_
20 #define GRID_H_
20 #define GRID_H_
21
21
22 #include "model.h"
22 #include "model.h"
23 #include <QtWidgets/QGraphicsWidget>
23 #include <QtWidgets/QGraphicsWidget>
24 #include <QtCharts/QChartGlobal>
24 #include <QtCharts/QChartGlobal>
25
25
26 QT_BEGIN_NAMESPACE
26 class QGraphicsGridLayout;
27 class QGraphicsGridLayout;
28 QT_END_NAMESPACE
29
27 class Chart;
30 class Chart;
28
31
29 QT_CHARTS_BEGIN_NAMESPACE
32 QT_CHARTS_BEGIN_NAMESPACE
30 class QChart;
33 class QChart;
31 QT_CHARTS_END_NAMESPACE
34 QT_CHARTS_END_NAMESPACE
32
35
33 QT_CHARTS_USE_NAMESPACE
36 QT_CHARTS_USE_NAMESPACE
34
37
35 class Grid : public QGraphicsWidget
38 class Grid : public QGraphicsWidget
36 {
39 {
37 Q_OBJECT
40 Q_OBJECT
38 public:
41 public:
39 enum State { NoState = 0, ZoomState, ScrollState};
42 enum State { NoState = 0, ZoomState, ScrollState};
40
43
41 Grid(int size, QGraphicsItem *parent = 0);
44 Grid(int size, QGraphicsItem *parent = 0);
42 ~Grid();
45 ~Grid();
43
46
44 QList<QChart *> charts();
47 QList<QChart *> charts();
45 void createCharts(const QString &category = QString());
48 void createCharts(const QString &category = QString());
46 void createCharts(const QString &category, const QString &subcategory, const QString &name);
49 void createCharts(const QString &category, const QString &subcategory, const QString &name);
47 void replaceChart(QChart *oldChart, Chart *newChart);
50 void replaceChart(QChart *oldChart, Chart *newChart);
48 void setState(State state);
51 void setState(State state);
49 State state() const { return m_state; };
52 State state() const { return m_state; };
50 void setRubberPen(const QPen &pen);
53 void setRubberPen(const QPen &pen);
51 void setSize(int size);
54 void setSize(int size);
52 int size() const {return m_size;}
55 int size() const {return m_size;}
53
56
54 Q_SIGNALS:
57 Q_SIGNALS:
55 void chartSelected(QChart *chart);
58 void chartSelected(QChart *chart);
56
59
57 protected:
60 protected:
58 void mousePressEvent(QGraphicsSceneMouseEvent *event);
61 void mousePressEvent(QGraphicsSceneMouseEvent *event);
59 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
62 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
60 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
63 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
61
64
62 private:
65 private:
63 void clear();
66 void clear();
64
67
65 private:
68 private:
66 int m_listCount;
69 int m_listCount;
67 int m_valueMax;
70 int m_valueMax;
68 int m_valueCount;
71 int m_valueCount;
69 int m_size;
72 int m_size;
70 DataTable m_dataTable;
73 DataTable m_dataTable;
71 QHash<QChart *, int> m_chartHash;
74 QHash<QChart *, int> m_chartHash;
72 QHash<int, QChart *> m_chartHashRev;
75 QHash<int, QChart *> m_chartHashRev;
73 State m_state;
76 State m_state;
74 State m_currentState;
77 State m_currentState;
75 QPointF m_origin;
78 QPointF m_origin;
76 QGraphicsRectItem *m_rubberBand;
79 QGraphicsRectItem *m_rubberBand;
77 QGraphicsGridLayout *m_gridLayout;
80 QGraphicsGridLayout *m_gridLayout;
78 };
81 };
79
82
80 #endif /* GRID_H_ */
83 #endif /* GRID_H_ */
@@ -1,40 +1,42
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef VIEW_H
19 #ifndef VIEW_H
20 #define VIEW_H
20 #define VIEW_H
21 #include <QtWidgets/QGraphicsView>
21 #include <QtWidgets/QGraphicsView>
22
22
23 QT_BEGIN_NAMESPACE
23 class QGraphicsScene;
24 class QGraphicsScene;
24 class QResizeEvent;
25 class QResizeEvent;
26 QT_END_NAMESPACE
25
27
26 class View: public QGraphicsView
28 class View: public QGraphicsView
27 {
29 {
28 public:
30 public:
29 View(QGraphicsScene *scene, QGraphicsWidget *form , QWidget *parent = 0);
31 View(QGraphicsScene *scene, QGraphicsWidget *form , QWidget *parent = 0);
30
32
31 protected:
33 protected:
32 void resizeEvent(QResizeEvent *event);
34 void resizeEvent(QResizeEvent *event);
33 void mouseMoveEvent(QMouseEvent *event);
35 void mouseMoveEvent(QMouseEvent *event);
34 void mouseReleaseEvent(QMouseEvent *event);
36 void mouseReleaseEvent(QMouseEvent *event);
35
37
36 private:
38 private:
37 QGraphicsWidget *m_form;
39 QGraphicsWidget *m_form;
38 };
40 };
39
41
40 #endif
42 #endif
@@ -1,115 +1,117
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef WINDOW_H
19 #ifndef WINDOW_H
20 #define WINDOW_H
20 #define WINDOW_H
21 #include <QtWidgets/QMainWindow>
21 #include <QtWidgets/QMainWindow>
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCore/QHash>
23 #include <QtCore/QHash>
24 #include <QtWidgets/QComboBox>
24 #include <QtWidgets/QComboBox>
25
25
26 QT_BEGIN_NAMESPACE
26 class QCheckBox;
27 class QCheckBox;
28 class QGraphicsLinearLayout;
27 class QGraphicsRectItem;
29 class QGraphicsRectItem;
28 class QGraphicsScene;
30 class QGraphicsScene;
29 class QGraphicsWidget;
31 class QGraphicsWidget;
32 QT_END_NAMESPACE
33
30 class View;
34 class View;
31 class QGraphicsLinearLayout;
32 class Chart;
35 class Chart;
33 class Grid;
36 class Grid;
34 class QPushButton;
35
37
36 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
37 class QChart;
39 class QChart;
38 QT_CHARTS_END_NAMESPACE
40 QT_CHARTS_END_NAMESPACE
39
41
40 QT_CHARTS_USE_NAMESPACE
42 QT_CHARTS_USE_NAMESPACE
41
43
42
44
43 class Window: public QMainWindow
45 class Window: public QMainWindow
44 {
46 {
45 Q_OBJECT
47 Q_OBJECT
46 public:
48 public:
47 explicit Window(const QVariantHash &parameters, QWidget *parent = 0);
49 explicit Window(const QVariantHash &parameters, QWidget *parent = 0);
48 ~Window();
50 ~Window();
49
51
50 private Q_SLOTS:
52 private Q_SLOTS:
51 void updateUI();
53 void updateUI();
52 void handleGeometryChanged();
54 void handleGeometryChanged();
53 void handleChartSelected(QChart *chart);
55 void handleChartSelected(QChart *chart);
54 private:
56 private:
55 QComboBox *createViewBox();
57 QComboBox *createViewBox();
56 QComboBox *createThemeBox();
58 QComboBox *createThemeBox();
57 QComboBox *createAnimationBox();
59 QComboBox *createAnimationBox();
58 QComboBox *createLegendBox();
60 QComboBox *createLegendBox();
59 QComboBox *createTempleteBox();
61 QComboBox *createTempleteBox();
60 void connectSignals();
62 void connectSignals();
61 void createProxyWidgets();
63 void createProxyWidgets();
62 void comboBoxFocused(QComboBox *combox);
64 void comboBoxFocused(QComboBox *combox);
63 inline void checkAnimationOptions();
65 inline void checkAnimationOptions();
64 inline void checkView();
66 inline void checkView();
65 inline void checkLegend();
67 inline void checkLegend();
66 inline void checkOpenGL();
68 inline void checkOpenGL();
67 inline void checkTheme();
69 inline void checkTheme();
68 inline void checkState();
70 inline void checkState();
69 inline void checkTemplate();
71 inline void checkTemplate();
70 QMenu *createMenu();
72 QMenu *createMenu();
71 QAction *createMenuAction(QMenu *menu, const QIcon &icon, const QString &text, const QVariant &data);
73 QAction *createMenuAction(QMenu *menu, const QIcon &icon, const QString &text, const QVariant &data);
72 void initializeFromParamaters(const QVariantHash &parameters);
74 void initializeFromParamaters(const QVariantHash &parameters);
73
75
74 private:
76 private:
75 QGraphicsScene *m_scene;
77 QGraphicsScene *m_scene;
76 View *m_view;
78 View *m_view;
77 QHash<QString, QGraphicsProxyWidget *> m_widgetHash;
79 QHash<QString, QGraphicsProxyWidget *> m_widgetHash;
78
80
79 QGraphicsWidget *m_form;
81 QGraphicsWidget *m_form;
80 QComboBox *m_themeComboBox;
82 QComboBox *m_themeComboBox;
81 QCheckBox *m_antialiasCheckBox;
83 QCheckBox *m_antialiasCheckBox;
82 QComboBox *m_animatedComboBox;
84 QComboBox *m_animatedComboBox;
83 QComboBox *m_legendComboBox;
85 QComboBox *m_legendComboBox;
84 QComboBox *m_templateComboBox;
86 QComboBox *m_templateComboBox;
85 QComboBox *m_viewComboBox;
87 QComboBox *m_viewComboBox;
86 QCheckBox *m_openGLCheckBox;
88 QCheckBox *m_openGLCheckBox;
87 QCheckBox *m_zoomCheckBox;
89 QCheckBox *m_zoomCheckBox;
88 QCheckBox *m_scrollCheckBox;
90 QCheckBox *m_scrollCheckBox;
89 QGraphicsLinearLayout *m_baseLayout;
91 QGraphicsLinearLayout *m_baseLayout;
90 QMenu *m_menu;
92 QMenu *m_menu;
91 int m_template;
93 int m_template;
92 Grid *m_grid;
94 Grid *m_grid;
93 QString m_category;
95 QString m_category;
94 QString m_subcategory;
96 QString m_subcategory;
95 QString m_name;
97 QString m_name;
96
98
97 friend class ComboBox;
99 friend class ComboBox;
98 };
100 };
99
101
100 class ComboBox: public QComboBox
102 class ComboBox: public QComboBox
101 {
103 {
102 public:
104 public:
103 ComboBox(Window *window, QWidget *parent = 0): QComboBox(parent), m_window(window)
105 ComboBox(Window *window, QWidget *parent = 0): QComboBox(parent), m_window(window)
104 {}
106 {}
105
107
106 protected:
108 protected:
107 void focusInEvent(QFocusEvent *e) {
109 void focusInEvent(QFocusEvent *e) {
108 QComboBox::focusInEvent(e);
110 QComboBox::focusInEvent(e);
109 m_window->comboBoxFocused(this);
111 m_window->comboBoxFocused(this);
110 }
112 }
111 private:
113 private:
112 Window *m_window;
114 Window *m_window;
113 };
115 };
114
116
115 #endif
117 #endif
@@ -1,53 +1,55
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef DATASERIEDIALOG_H
19 #ifndef DATASERIEDIALOG_H
20 #define DATASERIEDIALOG_H
20 #define DATASERIEDIALOG_H
21
21
22 #include <QtWidgets/QDialog>
22 #include <QtWidgets/QDialog>
23
23
24 QT_BEGIN_NAMESPACE
24 class QGroupBox;
25 class QGroupBox;
25 class QCheckBox;
26 class QCheckBox;
27 QT_END_NAMESPACE
26
28
27 class DataSerieDialog : public QDialog
29 class DataSerieDialog : public QDialog
28 {
30 {
29 Q_OBJECT
31 Q_OBJECT
30 public:
32 public:
31 explicit DataSerieDialog(QWidget *parent = 0);
33 explicit DataSerieDialog(QWidget *parent = 0);
32
34
33 signals:
35 signals:
34 void accepted(QString series, int columnCount, int rowCount, QString dataCharacteristics, bool labelsDefined);
36 void accepted(QString series, int columnCount, int rowCount, QString dataCharacteristics, bool labelsDefined);
35
37
36 public slots:
38 public slots:
37 void accept();
39 void accept();
38
40
39 private:
41 private:
40 QGroupBox *seriesTypeSelector();
42 QGroupBox *seriesTypeSelector();
41 QGroupBox *columnCountSelector();
43 QGroupBox *columnCountSelector();
42 QGroupBox *rowCountSelector();
44 QGroupBox *rowCountSelector();
43 QGroupBox *dataCharacteristicsSelector();
45 QGroupBox *dataCharacteristicsSelector();
44 void selectRadio(QGroupBox *groupBox, int defaultSelection);
46 void selectRadio(QGroupBox *groupBox, int defaultSelection);
45 QString radioSelection(QGroupBox *groupBox);
47 QString radioSelection(QGroupBox *groupBox);
46 QGroupBox *m_seriesTypeSelector;
48 QGroupBox *m_seriesTypeSelector;
47 QGroupBox *m_columnCountSelector;
49 QGroupBox *m_columnCountSelector;
48 QGroupBox *m_rowCountSelector;
50 QGroupBox *m_rowCountSelector;
49 QCheckBox *m_labelsSelector;
51 QCheckBox *m_labelsSelector;
50 QGroupBox *m_dataCharacteristicsSelector;
52 QGroupBox *m_dataCharacteristicsSelector;
51 };
53 };
52
54
53 #endif // DATASERIEDIALOG_H
55 #endif // DATASERIEDIALOG_H
@@ -1,78 +1,80
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef MAINWIDGET_H
19 #ifndef MAINWIDGET_H
20 #define MAINWIDGET_H
20 #define MAINWIDGET_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtCharts/QChart>
23 #include <QtCharts/QChart>
24 #include <QtCharts/QChartView>
24 #include <QtCharts/QChartView>
25 #include <QtWidgets/QWidget>
25 #include <QtWidgets/QWidget>
26
26
27 QT_BEGIN_NAMESPACE
27 class QSpinBox;
28 class QSpinBox;
28 class QCheckBox;
29 class QCheckBox;
29 class QGridLayout;
30 class QGridLayout;
31 QT_END_NAMESPACE
30
32
31 QT_CHARTS_USE_NAMESPACE
33 QT_CHARTS_USE_NAMESPACE
32
34
33 #define RealList QList<qreal>
35 #define RealList QList<qreal>
34 class DataSerieDialog;
36 class DataSerieDialog;
35
37
36 class MainWidget : public QWidget
38 class MainWidget : public QWidget
37 {
39 {
38 Q_OBJECT
40 Q_OBJECT
39 public:
41 public:
40 explicit MainWidget(QWidget *parent = 0);
42 explicit MainWidget(QWidget *parent = 0);
41
43
42 signals:
44 signals:
43
45
44 private:
46 private:
45 void initBackroundCombo(QGridLayout *grid);
47 void initBackroundCombo(QGridLayout *grid);
46 void initScaleControls(QGridLayout *grid);
48 void initScaleControls(QGridLayout *grid);
47 void initThemeCombo(QGridLayout *grid);
49 void initThemeCombo(QGridLayout *grid);
48 void initCheckboxes(QGridLayout *grid);
50 void initCheckboxes(QGridLayout *grid);
49
51
50 private slots:
52 private slots:
51 void addSeries();
53 void addSeries();
52 void addSeries(QString series, int columnCount, int rowCount, QString dataCharacteristics, bool labelsEnabled);
54 void addSeries(QString series, int columnCount, int rowCount, QString dataCharacteristics, bool labelsEnabled);
53 void backgroundChanged(int itemIndex);
55 void backgroundChanged(int itemIndex);
54 void autoScaleChanged(int value);
56 void autoScaleChanged(int value);
55 void xMinChanged(int value);
57 void xMinChanged(int value);
56 void xMaxChanged(int value);
58 void xMaxChanged(int value);
57 void yMinChanged(int value);
59 void yMinChanged(int value);
58 void yMaxChanged(int value);
60 void yMaxChanged(int value);
59 void antiAliasToggled(bool enabled);
61 void antiAliasToggled(bool enabled);
60 void openGLToggled(bool enabled);
62 void openGLToggled(bool enabled);
61 void changeChartTheme(int themeIndex);
63 void changeChartTheme(int themeIndex);
62 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
64 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
63 QStringList generateLabels(int count);
65 QStringList generateLabels(int count);
64
66
65 private:
67 private:
66 DataSerieDialog *m_addSerieDialog;
68 DataSerieDialog *m_addSerieDialog;
67 QChart *m_chart;
69 QChart *m_chart;
68 QChartView *m_chartView;
70 QChartView *m_chartView;
69 QCheckBox *m_autoScaleCheck;
71 QCheckBox *m_autoScaleCheck;
70 QSpinBox *m_xMinSpin;
72 QSpinBox *m_xMinSpin;
71 QSpinBox *m_xMaxSpin;
73 QSpinBox *m_xMaxSpin;
72 QSpinBox *m_yMinSpin;
74 QSpinBox *m_yMinSpin;
73 QSpinBox *m_yMaxSpin;
75 QSpinBox *m_yMaxSpin;
74 QString m_defaultSeriesName;
76 QString m_defaultSeriesName;
75 QGridLayout *m_scatterLayout;
77 QGridLayout *m_scatterLayout;
76 };
78 };
77
79
78 #endif // MAINWIDGET_H
80 #endif // MAINWIDGET_H
@@ -1,157 +1,160
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2014 Digia Plc
3 ** Copyright (C) 2014 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.io
5 ** For any questions to Digia, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and Digia.
12 ** agreement between you and Digia.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef MAINWINDOW_H
19 #ifndef MAINWINDOW_H
20 #define MAINWINDOW_H
20 #define MAINWINDOW_H
21
21
22 #include <QtCharts/QPolarChart>
22 #include <QtCharts/QPolarChart>
23 #include <QtWidgets/QMainWindow>
23 #include <QtWidgets/QMainWindow>
24 #include <QtGui/QFont>
24 #include <QtGui/QFont>
25 #include <QtCharts/QChart>
25 #include <QtCharts/QChart>
26 #include <QtCharts/QScatterSeries>
26 #include <QtCharts/QScatterSeries>
27 #include <QtCharts/QLineSeries>
27 #include <QtCharts/QLineSeries>
28 #include <QtCharts/QSplineSeries>
28 #include <QtCharts/QSplineSeries>
29 #include <QtCharts/QAreaSeries>
29 #include <QtCharts/QAreaSeries>
30
30
31 QT_BEGIN_NAMESPACE
32 class QBrush;
33 class QPen;
34
31 namespace Ui {
35 namespace Ui {
32 class MainWindow;
36 class MainWindow;
33 }
37 }
38 QT_END_NAMESPACE
34
39
35 QT_CHARTS_USE_NAMESPACE
36
40
37 class QBrush;
41 QT_CHARTS_USE_NAMESPACE
38 class QPen;
39
42
40 class MainWindow : public QMainWindow
43 class MainWindow : public QMainWindow
41 {
44 {
42 Q_OBJECT
45 Q_OBJECT
43
46
44 public:
47 public:
45 explicit MainWindow(QWidget *parent = 0);
48 explicit MainWindow(QWidget *parent = 0);
46 ~MainWindow();
49 ~MainWindow();
47
50
48 public slots:
51 public slots:
49 void angularTicksChanged(int value);
52 void angularTicksChanged(int value);
50 void radialTicksChanged(int value);
53 void radialTicksChanged(int value);
51 void anglesChanged(int value);
54 void anglesChanged(int value);
52 void angularMinChanged(double value);
55 void angularMinChanged(double value);
53 void angularMaxChanged(double value);
56 void angularMaxChanged(double value);
54 void radialMinChanged(double value);
57 void radialMinChanged(double value);
55 void radialMaxChanged(double value);
58 void radialMaxChanged(double value);
56 void angularShadesIndexChanged(int index);
59 void angularShadesIndexChanged(int index);
57 void radialShadesIndexChanged(int index);
60 void radialShadesIndexChanged(int index);
58 void labelFormatEdited(const QString &text);
61 void labelFormatEdited(const QString &text);
59 void labelFontChanged(const QFont &font);
62 void labelFontChanged(const QFont &font);
60 void labelFontSizeChanged(int value);
63 void labelFontSizeChanged(int value);
61 void animationIndexChanged(int index);
64 void animationIndexChanged(int index);
62 void labelsIndexChanged(int index);
65 void labelsIndexChanged(int index);
63 void titleIndexChanged(int index);
66 void titleIndexChanged(int index);
64 void titleFontChanged(const QFont &font);
67 void titleFontChanged(const QFont &font);
65 void titleFontSizeChanged(int value);
68 void titleFontSizeChanged(int value);
66 void gridIndexChanged(int index);
69 void gridIndexChanged(int index);
67 void arrowIndexChanged(int index);
70 void arrowIndexChanged(int index);
68 void angularRangeChanged(qreal min, qreal max);
71 void angularRangeChanged(qreal min, qreal max);
69 void radialRangeChanged(qreal min, qreal max);
72 void radialRangeChanged(qreal min, qreal max);
70 void angularAxisIndexChanged(int index);
73 void angularAxisIndexChanged(int index);
71 void radialAxisIndexChanged(int index);
74 void radialAxisIndexChanged(int index);
72 void logBaseChanged(double value);
75 void logBaseChanged(double value);
73 void niceNumbersChecked();
76 void niceNumbersChecked();
74 void dateFormatEdited(const QString &text);
77 void dateFormatEdited(const QString &text);
75 void moreCategoriesChecked();
78 void moreCategoriesChecked();
76 void series1CheckBoxChecked();
79 void series1CheckBoxChecked();
77 void series2CheckBoxChecked();
80 void series2CheckBoxChecked();
78 void series3CheckBoxChecked();
81 void series3CheckBoxChecked();
79 void series4CheckBoxChecked();
82 void series4CheckBoxChecked();
80 void series5CheckBoxChecked();
83 void series5CheckBoxChecked();
81 void series6CheckBoxChecked();
84 void series6CheckBoxChecked();
82 void series7CheckBoxChecked();
85 void series7CheckBoxChecked();
83 void themeIndexChanged(int index);
86 void themeIndexChanged(int index);
84 void seriesHovered(QPointF point, bool state);
87 void seriesHovered(QPointF point, bool state);
85 void seriesClicked(const QPointF &point);
88 void seriesClicked(const QPointF &point);
86 void backgroundIndexChanged(int index);
89 void backgroundIndexChanged(int index);
87 void plotAreaIndexChanged(int index);
90 void plotAreaIndexChanged(int index);
88
91
89 private:
92 private:
90 enum AxisMode {
93 enum AxisMode {
91 AxisModeNone,
94 AxisModeNone,
92 AxisModeValue,
95 AxisModeValue,
93 AxisModeLogValue,
96 AxisModeLogValue,
94 AxisModeDateTime,
97 AxisModeDateTime,
95 AxisModeCategory
98 AxisModeCategory
96 };
99 };
97
100
98 void initXYValueChart();
101 void initXYValueChart();
99 void setAngularAxis(AxisMode mode);
102 void setAngularAxis(AxisMode mode);
100 void setRadialAxis(AxisMode mode);
103 void setRadialAxis(AxisMode mode);
101
104
102 void applyRanges();
105 void applyRanges();
103 void applyCategories();
106 void applyCategories();
104
107
105 Ui::MainWindow *ui;
108 Ui::MainWindow *ui;
106
109
107 int m_angularTickCount;
110 int m_angularTickCount;
108 int m_radialTickCount;
111 int m_radialTickCount;
109 qreal m_labelsAngle;
112 qreal m_labelsAngle;
110 qreal m_angularMin;
113 qreal m_angularMin;
111 qreal m_angularMax;
114 qreal m_angularMax;
112 qreal m_radialMin;
115 qreal m_radialMin;
113 qreal m_radialMax;
116 qreal m_radialMax;
114 bool m_angularShadesVisible;
117 bool m_angularShadesVisible;
115 bool m_radialShadesVisible;
118 bool m_radialShadesVisible;
116 bool m_labelsVisible;
119 bool m_labelsVisible;
117 bool m_titleVisible;
120 bool m_titleVisible;
118 bool m_gridVisible;
121 bool m_gridVisible;
119 bool m_arrowVisible;
122 bool m_arrowVisible;
120 QBrush *m_angularShadesBrush;
123 QBrush *m_angularShadesBrush;
121 QBrush *m_radialShadesBrush;
124 QBrush *m_radialShadesBrush;
122 QBrush *m_labelBrush;
125 QBrush *m_labelBrush;
123 QBrush *m_titleBrush;
126 QBrush *m_titleBrush;
124 QBrush *m_backgroundBrush;
127 QBrush *m_backgroundBrush;
125 QBrush *m_plotAreaBackgroundBrush;
128 QBrush *m_plotAreaBackgroundBrush;
126 QPen *m_angularShadesPen;
129 QPen *m_angularShadesPen;
127 QPen *m_radialShadesPen;
130 QPen *m_radialShadesPen;
128 QPen *m_gridPen;
131 QPen *m_gridPen;
129 QPen *m_arrowPen;
132 QPen *m_arrowPen;
130 QPen *m_backgroundPen;
133 QPen *m_backgroundPen;
131 QPen *m_plotAreaBackgroundPen;
134 QPen *m_plotAreaBackgroundPen;
132 QString m_labelFormat;
135 QString m_labelFormat;
133 QFont m_currentLabelFont;
136 QFont m_currentLabelFont;
134 QFont m_currentTitleFont;
137 QFont m_currentTitleFont;
135 QChart::AnimationOptions m_animationOptions;
138 QChart::AnimationOptions m_animationOptions;
136 QString m_angularTitle;
139 QString m_angularTitle;
137 QString m_radialTitle;
140 QString m_radialTitle;
138 qreal m_base;
141 qreal m_base;
139 QString m_dateFormat;
142 QString m_dateFormat;
140
143
141 QPolarChart *m_chart;
144 QPolarChart *m_chart;
142 QAbstractAxis *m_angularAxis;
145 QAbstractAxis *m_angularAxis;
143 QAbstractAxis *m_radialAxis;
146 QAbstractAxis *m_radialAxis;
144 AxisMode m_angularAxisMode;
147 AxisMode m_angularAxisMode;
145 AxisMode m_radialAxisMode;
148 AxisMode m_radialAxisMode;
146 bool m_moreCategories;
149 bool m_moreCategories;
147
150
148 QScatterSeries *m_series1;
151 QScatterSeries *m_series1;
149 QLineSeries *m_series2;
152 QLineSeries *m_series2;
150 QLineSeries *m_series3;
153 QLineSeries *m_series3;
151 QLineSeries *m_series4;
154 QLineSeries *m_series4;
152 QAreaSeries *m_series5;
155 QAreaSeries *m_series5;
153 QSplineSeries *m_series6;
156 QSplineSeries *m_series6;
154 QScatterSeries *m_series7;
157 QScatterSeries *m_series7;
155 };
158 };
156
159
157 #endif // MAINWINDOW_H
160 #endif // MAINWINDOW_H
General Comments 0
You need to be logged in to leave comments. Login now