@@ -1,53 +1,62 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef AXISANIMATION_H |
|
30 | #ifndef AXISANIMATION_H | |
22 | #define AXISANIMATION_H |
|
31 | #define AXISANIMATION_H | |
23 |
|
32 | |||
24 | #include "chartanimation_p.h" |
|
33 | #include "chartanimation_p.h" | |
25 | #include <QPointF> |
|
34 | #include <QPointF> | |
26 |
|
35 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
37 | |||
29 | class ChartAxis; |
|
38 | class ChartAxis; | |
30 |
|
39 | |||
31 | class AxisAnimation: public ChartAnimation |
|
40 | class AxisAnimation: public ChartAnimation | |
32 | { |
|
41 | { | |
33 | public: |
|
42 | public: | |
34 | enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation}; |
|
43 | enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation}; | |
35 | AxisAnimation(ChartAxis *axis); |
|
44 | AxisAnimation(ChartAxis *axis); | |
36 | ~AxisAnimation(); |
|
45 | ~AxisAnimation(); | |
37 | void setAnimationType(Animation type); |
|
46 | void setAnimationType(Animation type); | |
38 | void setAnimationPoint(const QPointF& point); |
|
47 | void setAnimationPoint(const QPointF& point); | |
39 | void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout); |
|
48 | void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout); | |
40 | protected: |
|
49 | protected: | |
41 | QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress ) const; |
|
50 | QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress ) const; | |
42 | void updateCurrentValue(const QVariant &value ); |
|
51 | void updateCurrentValue(const QVariant &value ); | |
43 | private: |
|
52 | private: | |
44 | ChartAxis *m_axis; |
|
53 | ChartAxis *m_axis; | |
45 | Animation m_type; |
|
54 | Animation m_type; | |
46 | QPointF m_point; |
|
55 | QPointF m_point; | |
47 | }; |
|
56 | }; | |
48 |
|
57 | |||
49 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | QTCOMMERCIALCHART_END_NAMESPACE | |
50 |
|
59 | |||
51 |
|
60 | |||
52 |
|
61 | |||
53 | #endif /* AXISITEM_H_ */ |
|
62 | #endif /* AXISITEM_H_ */ |
@@ -1,54 +1,63 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef BARANIMATION_P_H |
|
30 | #ifndef BARANIMATION_P_H | |
22 | #define BARANIMATION_P_H |
|
31 | #define BARANIMATION_P_H | |
23 |
|
32 | |||
24 | #include "chartanimation_p.h" |
|
33 | #include "chartanimation_p.h" | |
25 | #include "barchartitem_p.h" |
|
34 | #include "barchartitem_p.h" | |
26 |
|
35 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
37 | |||
29 | class BarChartItem; |
|
38 | class BarChartItem; | |
30 | class QBarSet; |
|
39 | class QBarSet; | |
31 | class BarSetAnimation; |
|
40 | class BarSetAnimation; | |
32 |
|
41 | |||
33 | class BarAnimation : public ChartAnimation |
|
42 | class BarAnimation : public ChartAnimation | |
34 | { |
|
43 | { | |
35 | Q_OBJECT |
|
44 | Q_OBJECT | |
36 |
|
45 | |||
37 | public: |
|
46 | public: | |
38 | BarAnimation(BarChartItem *item); |
|
47 | BarAnimation(BarChartItem *item); | |
39 | ~BarAnimation(); |
|
48 | ~BarAnimation(); | |
40 |
|
49 | |||
41 | public: // from QVariantAnimation |
|
50 | public: // from QVariantAnimation | |
42 | virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; |
|
51 | virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; | |
43 | virtual void updateCurrentValue(const QVariant &value); |
|
52 | virtual void updateCurrentValue(const QVariant &value); | |
44 |
|
53 | |||
45 | public Q_SLOTS: |
|
54 | public Q_SLOTS: | |
46 |
|
55 | |||
47 | private: |
|
56 | private: | |
48 | BarChartItem *m_item; |
|
57 | BarChartItem *m_item; | |
49 | QHash<QBarSet *, BarSetAnimation *> m_animations; |
|
58 | QHash<QBarSet *, BarSetAnimation *> m_animations; | |
50 | }; |
|
59 | }; | |
51 |
|
60 | |||
52 | QTCOMMERCIALCHART_END_NAMESPACE |
|
61 | QTCOMMERCIALCHART_END_NAMESPACE | |
53 |
|
62 | |||
54 | #endif |
|
63 | #endif |
@@ -1,42 +1,51 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTANIMATION_H |
|
30 | #ifndef CHARTANIMATION_H | |
22 | #define CHARTANIMATION_H |
|
31 | #define CHARTANIMATION_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include <QVariantAnimation> |
|
34 | #include <QVariantAnimation> | |
26 |
|
35 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
37 | |||
29 | const static int ChartAnimationDuration = 1000; |
|
38 | const static int ChartAnimationDuration = 1000; | |
30 |
|
39 | |||
31 | class ChartAnimation: public QVariantAnimation |
|
40 | class ChartAnimation: public QVariantAnimation | |
32 | { |
|
41 | { | |
33 | Q_OBJECT |
|
42 | Q_OBJECT | |
34 | public: |
|
43 | public: | |
35 | ChartAnimation(QObject *parent = 0):QVariantAnimation(parent){}; |
|
44 | ChartAnimation(QObject *parent = 0):QVariantAnimation(parent){}; | |
36 | }; |
|
45 | }; | |
37 |
|
46 | |||
38 | QTCOMMERCIALCHART_END_NAMESPACE |
|
47 | QTCOMMERCIALCHART_END_NAMESPACE | |
39 |
|
48 | |||
40 |
|
49 | |||
41 |
|
50 | |||
42 | #endif /* AXISITEM_H_ */ |
|
51 | #endif /* AXISITEM_H_ */ |
@@ -1,64 +1,73 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTANIMATOR_P_H |
|
30 | #ifndef CHARTANIMATOR_P_H | |
22 | #define CHARTANIMATOR_P_H |
|
31 | #define CHARTANIMATOR_P_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "chartanimation_p.h" |
|
34 | #include "chartanimation_p.h" | |
26 | #include "piechartitem_p.h" |
|
35 | #include "piechartitem_p.h" | |
27 | #include "barchartitem_p.h" |
|
36 | #include "barchartitem_p.h" | |
28 | #include <QPointF> |
|
37 | #include <QPointF> | |
29 |
|
38 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
40 | |||
32 | class ChartItem; |
|
41 | class ChartItem; | |
33 | class ChartAxis; |
|
42 | class ChartAxis; | |
34 | class AreaChartItem; |
|
43 | class AreaChartItem; | |
35 | class SplineChartItem; |
|
44 | class SplineChartItem; | |
36 | class ScatterChartItem; |
|
45 | class ScatterChartItem; | |
37 | class LineChartItem; |
|
46 | class LineChartItem; | |
38 | class XYChartItem; |
|
47 | class XYChartItem; | |
39 | class XYAnimation; |
|
48 | class XYAnimation; | |
40 |
|
49 | |||
41 | class ChartAnimator : public QObject |
|
50 | class ChartAnimator : public QObject | |
42 | { |
|
51 | { | |
43 | Q_OBJECT |
|
52 | Q_OBJECT | |
44 | public: |
|
53 | public: | |
45 | ChartAnimator(QObject *parent = 0); |
|
54 | ChartAnimator(QObject *parent = 0); | |
46 | virtual ~ChartAnimator(); |
|
55 | virtual ~ChartAnimator(); | |
47 |
|
56 | |||
48 | void addAnimation(PieChartItem *item); |
|
57 | void addAnimation(PieChartItem *item); | |
49 | void addAnimation(BarChartItem *item); |
|
58 | void addAnimation(BarChartItem *item); | |
50 | void removeAnimation(Chart *item); |
|
59 | void removeAnimation(Chart *item); | |
51 |
|
60 | |||
52 | void addAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData, bool isEmpty); |
|
61 | void addAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData, bool isEmpty); | |
53 | void removeAnimation(PieChartItem *item, PieSliceItem *sliceItem); |
|
62 | void removeAnimation(PieChartItem *item, PieSliceItem *sliceItem); | |
54 | void updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData); |
|
63 | void updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData); | |
55 |
|
64 | |||
56 | void updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); |
|
65 | void updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout); | |
57 |
|
66 | |||
58 | private: |
|
67 | private: | |
59 | QMap<Chart *, ChartAnimation *> m_animations; |
|
68 | QMap<Chart *, ChartAnimation *> m_animations; | |
60 | }; |
|
69 | }; | |
61 |
|
70 | |||
62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
71 | QTCOMMERCIALCHART_END_NAMESPACE | |
63 |
|
72 | |||
64 | #endif |
|
73 | #endif |
@@ -1,53 +1,62 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef PIEANIMATION_P_H |
|
30 | #ifndef PIEANIMATION_P_H | |
22 | #define PIEANIMATION_P_H |
|
31 | #define PIEANIMATION_P_H | |
23 |
|
32 | |||
24 | #include "chartanimation_p.h" |
|
33 | #include "chartanimation_p.h" | |
25 | #include "piechartitem_p.h" |
|
34 | #include "piechartitem_p.h" | |
26 | #include "piesliceanimation_p.h" |
|
35 | #include "piesliceanimation_p.h" | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class PieChartItem; |
|
39 | class PieChartItem; | |
31 |
|
40 | |||
32 | class PieAnimation : public ChartAnimation |
|
41 | class PieAnimation : public ChartAnimation | |
33 | { |
|
42 | { | |
34 | Q_OBJECT |
|
43 | Q_OBJECT | |
35 |
|
44 | |||
36 | public: |
|
45 | public: | |
37 | PieAnimation(PieChartItem *item); |
|
46 | PieAnimation(PieChartItem *item); | |
38 | ~PieAnimation(); |
|
47 | ~PieAnimation(); | |
39 | void updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue); |
|
48 | void updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue); | |
40 | void addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation); |
|
49 | void addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation); | |
41 | void removeSlice(PieSliceItem *sliceItem); |
|
50 | void removeSlice(PieSliceItem *sliceItem); | |
42 |
|
51 | |||
43 | public: // from QVariantAnimation |
|
52 | public: // from QVariantAnimation | |
44 | void updateCurrentValue(const QVariant &value); |
|
53 | void updateCurrentValue(const QVariant &value); | |
45 |
|
54 | |||
46 | private: |
|
55 | private: | |
47 | PieChartItem *m_item; |
|
56 | PieChartItem *m_item; | |
48 | QHash<PieSliceItem *, PieSliceAnimation *> m_animations; |
|
57 | QHash<PieSliceItem *, PieSliceAnimation *> m_animations; | |
49 | }; |
|
58 | }; | |
50 |
|
59 | |||
51 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | QTCOMMERCIALCHART_END_NAMESPACE | |
52 |
|
61 | |||
53 | #endif |
|
62 | #endif |
@@ -1,51 +1,60 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef PIESLICEANIMATION_P_H |
|
30 | #ifndef PIESLICEANIMATION_P_H | |
22 | #define PIESLICEANIMATION_P_H |
|
31 | #define PIESLICEANIMATION_P_H | |
23 |
|
32 | |||
24 | #include <QVariantAnimation> |
|
33 | #include <QVariantAnimation> | |
25 | #include "piesliceitem_p.h" |
|
34 | #include "piesliceitem_p.h" | |
26 |
|
35 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
37 | |||
29 | class PieChartItem; |
|
38 | class PieChartItem; | |
30 |
|
39 | |||
31 | class PieSliceAnimation : public QVariantAnimation |
|
40 | class PieSliceAnimation : public QVariantAnimation | |
32 | { |
|
41 | { | |
33 | public: |
|
42 | public: | |
34 | PieSliceAnimation(PieSliceItem *sliceItem); |
|
43 | PieSliceAnimation(PieSliceItem *sliceItem); | |
35 | ~PieSliceAnimation(); |
|
44 | ~PieSliceAnimation(); | |
36 | void setValue(const PieSliceData &startValue, const PieSliceData &endValue); |
|
45 | void setValue(const PieSliceData &startValue, const PieSliceData &endValue); | |
37 | void updateValue(const PieSliceData &endValue); |
|
46 | void updateValue(const PieSliceData &endValue); | |
38 | PieSliceData currentSliceValue(); |
|
47 | PieSliceData currentSliceValue(); | |
39 |
|
48 | |||
40 | protected: |
|
49 | protected: | |
41 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const; |
|
50 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const; | |
42 | void updateCurrentValue(const QVariant &value); |
|
51 | void updateCurrentValue(const QVariant &value); | |
43 |
|
52 | |||
44 | private: |
|
53 | private: | |
45 | PieSliceItem *m_sliceItem; |
|
54 | PieSliceItem *m_sliceItem; | |
46 | PieSliceData m_currentValue; |
|
55 | PieSliceData m_currentValue; | |
47 | }; |
|
56 | }; | |
48 |
|
57 | |||
49 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | QTCOMMERCIALCHART_END_NAMESPACE | |
50 |
|
59 | |||
51 | #endif |
|
60 | #endif |
@@ -1,52 +1,61 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef SPLINEANIMATION_P_H |
|
30 | #ifndef SPLINEANIMATION_P_H | |
22 | #define SPLINEANIMATION_P_H |
|
31 | #define SPLINEANIMATION_P_H | |
23 | #include "xyanimation_p.h" |
|
32 | #include "xyanimation_p.h" | |
24 | #include <QPointF> |
|
33 | #include <QPointF> | |
25 |
|
34 | |||
26 | typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector; |
|
35 | typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector; | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class SplineChartItem; |
|
39 | class SplineChartItem; | |
31 |
|
40 | |||
32 | class SplineAnimation : public XYAnimation |
|
41 | class SplineAnimation : public XYAnimation | |
33 | { |
|
42 | { | |
34 | public: |
|
43 | public: | |
35 | SplineAnimation(SplineChartItem *item); |
|
44 | SplineAnimation(SplineChartItem *item); | |
36 | ~SplineAnimation(); |
|
45 | ~SplineAnimation(); | |
37 | void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1); |
|
46 | void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1); | |
38 |
|
47 | |||
39 | protected: |
|
48 | protected: | |
40 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const; |
|
49 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const; | |
41 | void updateCurrentValue(const QVariant &value); |
|
50 | void updateCurrentValue(const QVariant &value); | |
42 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); |
|
51 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); | |
43 |
|
52 | |||
44 | private: |
|
53 | private: | |
45 | SplineVector m_oldSpline; |
|
54 | SplineVector m_oldSpline; | |
46 | SplineVector m_newSpline; |
|
55 | SplineVector m_newSpline; | |
47 | SplineChartItem *m_item; |
|
56 | SplineChartItem *m_item; | |
48 | }; |
|
57 | }; | |
49 |
|
58 | |||
50 | QTCOMMERCIALCHART_END_NAMESPACE |
|
59 | QTCOMMERCIALCHART_END_NAMESPACE | |
51 |
|
60 | |||
52 | #endif |
|
61 | #endif |
@@ -1,57 +1,66 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef XYANIMATION_P_H |
|
30 | #ifndef XYANIMATION_P_H | |
22 | #define XYANIMATION_P_H |
|
31 | #define XYANIMATION_P_H | |
23 |
|
32 | |||
24 | #include "chartanimation_p.h" |
|
33 | #include "chartanimation_p.h" | |
25 | #include <QPointF> |
|
34 | #include <QPointF> | |
26 |
|
35 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
37 | |||
29 | class XYChart; |
|
38 | class XYChart; | |
30 |
|
39 | |||
31 | class XYAnimation : public ChartAnimation |
|
40 | class XYAnimation : public ChartAnimation | |
32 | { |
|
41 | { | |
33 | protected: |
|
42 | protected: | |
34 | enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation }; |
|
43 | enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation }; | |
35 | public: |
|
44 | public: | |
36 | XYAnimation(XYChart *item); |
|
45 | XYAnimation(XYChart *item); | |
37 | ~XYAnimation(); |
|
46 | ~XYAnimation(); | |
38 | void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints,int index = -1); |
|
47 | void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints,int index = -1); | |
39 | Animation animationType() const { return m_type; }; |
|
48 | Animation animationType() const { return m_type; }; | |
40 |
|
49 | |||
41 | protected: |
|
50 | protected: | |
42 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress ) const; |
|
51 | QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress ) const; | |
43 | void updateCurrentValue (const QVariant &value ); |
|
52 | void updateCurrentValue (const QVariant &value ); | |
44 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); |
|
53 | void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); | |
45 | protected: |
|
54 | protected: | |
46 | Animation m_type; |
|
55 | Animation m_type; | |
47 | bool m_dirty; |
|
56 | bool m_dirty; | |
48 | int m_index; |
|
57 | int m_index; | |
49 | private: |
|
58 | private: | |
50 | XYChart *m_item; |
|
59 | XYChart *m_item; | |
51 | QVector<QPointF> m_oldPoints; |
|
60 | QVector<QPointF> m_oldPoints; | |
52 | QVector<QPointF> m_newPoints; |
|
61 | QVector<QPointF> m_newPoints; | |
53 | }; |
|
62 | }; | |
54 |
|
63 | |||
55 | QTCOMMERCIALCHART_END_NAMESPACE |
|
64 | QTCOMMERCIALCHART_END_NAMESPACE | |
56 |
|
65 | |||
57 | #endif |
|
66 | #endif |
@@ -1,94 +1,103 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef AREACHARTITEM_H |
|
30 | #ifndef AREACHARTITEM_H | |
22 | #define AREACHARTITEM_H |
|
31 | #define AREACHARTITEM_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "linechartitem_p.h" |
|
34 | #include "linechartitem_p.h" | |
26 | #include <QPen> |
|
35 | #include <QPen> | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class QAreaSeries; |
|
39 | class QAreaSeries; | |
31 | class AreaChartItem; |
|
40 | class AreaChartItem; | |
32 |
|
41 | |||
33 | class AreaChartItem : public ChartItem |
|
42 | class AreaChartItem : public ChartItem | |
34 | { |
|
43 | { | |
35 | Q_OBJECT |
|
44 | Q_OBJECT | |
36 | public: |
|
45 | public: | |
37 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); |
|
46 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); | |
38 | ~AreaChartItem(); |
|
47 | ~AreaChartItem(); | |
39 |
|
48 | |||
40 | //from QGraphicsItem |
|
49 | //from QGraphicsItem | |
41 | QRectF boundingRect() const; |
|
50 | QRectF boundingRect() const; | |
42 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
43 | QPainterPath shape() const; |
|
52 | QPainterPath shape() const; | |
44 |
|
53 | |||
45 | LineChartItem* upperLineItem() const { return m_upper; } |
|
54 | LineChartItem* upperLineItem() const { return m_upper; } | |
46 | LineChartItem* lowerLineItem() const { return m_lower; } |
|
55 | LineChartItem* lowerLineItem() const { return m_lower; } | |
47 |
|
56 | |||
48 | void updatePath(); |
|
57 | void updatePath(); | |
49 |
|
58 | |||
50 | protected: |
|
59 | protected: | |
51 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
60 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
52 |
|
61 | |||
53 | Q_SIGNALS: |
|
62 | Q_SIGNALS: | |
54 | void clicked(const QPointF &point); |
|
63 | void clicked(const QPointF &point); | |
55 |
|
64 | |||
56 | public Q_SLOTS: |
|
65 | public Q_SLOTS: | |
57 | void handleUpdated(); |
|
66 | void handleUpdated(); | |
58 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
67 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
59 | void handleGeometryChanged(const QRectF &size); |
|
68 | void handleGeometryChanged(const QRectF &size); | |
60 |
|
69 | |||
61 | private: |
|
70 | private: | |
62 | QAreaSeries* m_series; |
|
71 | QAreaSeries* m_series; | |
63 | LineChartItem* m_upper; |
|
72 | LineChartItem* m_upper; | |
64 | LineChartItem* m_lower; |
|
73 | LineChartItem* m_lower; | |
65 | QPainterPath m_path; |
|
74 | QPainterPath m_path; | |
66 | QRectF m_rect; |
|
75 | QRectF m_rect; | |
67 | QRectF m_clipRect; |
|
76 | QRectF m_clipRect; | |
68 | QPen m_linePen; |
|
77 | QPen m_linePen; | |
69 | QPen m_pointPen; |
|
78 | QPen m_pointPen; | |
70 | QBrush m_brush; |
|
79 | QBrush m_brush; | |
71 | bool m_pointsVisible; |
|
80 | bool m_pointsVisible; | |
72 |
|
81 | |||
73 | }; |
|
82 | }; | |
74 |
|
83 | |||
75 | class AreaBoundItem : public LineChartItem |
|
84 | class AreaBoundItem : public LineChartItem | |
76 | { |
|
85 | { | |
77 | public: |
|
86 | public: | |
78 | AreaBoundItem(AreaChartItem *item,QLineSeries *lineSeries,ChartPresenter* presenter) : LineChartItem(lineSeries, 0), m_item(item) { |
|
87 | AreaBoundItem(AreaChartItem *item,QLineSeries *lineSeries,ChartPresenter* presenter) : LineChartItem(lineSeries, 0), m_item(item) { | |
79 | setPresenter(presenter); |
|
88 | setPresenter(presenter); | |
80 | } |
|
89 | } | |
81 | ~AreaBoundItem() {} |
|
90 | ~AreaBoundItem() {} | |
82 |
|
91 | |||
83 | void updateGeometry() { |
|
92 | void updateGeometry() { | |
84 | LineChartItem::updateGeometry(); |
|
93 | LineChartItem::updateGeometry(); | |
85 | m_item->updatePath(); |
|
94 | m_item->updatePath(); | |
86 | } |
|
95 | } | |
87 |
|
96 | |||
88 | private: |
|
97 | private: | |
89 | AreaChartItem* m_item; |
|
98 | AreaChartItem* m_item; | |
90 | }; |
|
99 | }; | |
91 |
|
100 | |||
92 | QTCOMMERCIALCHART_END_NAMESPACE |
|
101 | QTCOMMERCIALCHART_END_NAMESPACE | |
93 |
|
102 | |||
94 | #endif |
|
103 | #endif |
@@ -1,148 +1,157 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTAXIS_H |
|
30 | #ifndef CHARTAXIS_H | |
22 | #define CHARTAXIS_H |
|
31 | #define CHARTAXIS_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "chart_p.h" |
|
34 | #include "chart_p.h" | |
26 | #include "axisanimation_p.h" |
|
35 | #include "axisanimation_p.h" | |
27 | #include <QGraphicsItem> |
|
36 | #include <QGraphicsItem> | |
28 |
|
37 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
39 | |||
31 | class QAxis; |
|
40 | class QAxis; | |
32 | class ChartPresenter; |
|
41 | class ChartPresenter; | |
33 |
|
42 | |||
34 | class ChartAxis : public Chart |
|
43 | class ChartAxis : public Chart | |
35 | { |
|
44 | { | |
36 | Q_OBJECT |
|
45 | Q_OBJECT | |
37 | public: |
|
46 | public: | |
38 | enum AxisType{ X_AXIS,Y_AXIS }; |
|
47 | enum AxisType{ X_AXIS,Y_AXIS }; | |
39 |
|
48 | |||
40 | ChartAxis(QAxis *axis, ChartPresenter *presenter); |
|
49 | ChartAxis(QAxis *axis, ChartPresenter *presenter); | |
41 | ~ChartAxis(); |
|
50 | ~ChartAxis(); | |
42 |
|
51 | |||
43 | virtual AxisType axisType() const = 0; |
|
52 | virtual AxisType axisType() const = 0; | |
44 |
|
53 | |||
45 | void setAxisOpacity(qreal opacity); |
|
54 | void setAxisOpacity(qreal opacity); | |
46 | qreal axisOpacity() const; |
|
55 | qreal axisOpacity() const; | |
47 |
|
56 | |||
48 | void setGridOpacity(qreal opacity); |
|
57 | void setGridOpacity(qreal opacity); | |
49 | qreal gridOpacity() const; |
|
58 | qreal gridOpacity() const; | |
50 |
|
59 | |||
51 | void setLabelsOpacity(qreal opacity); |
|
60 | void setLabelsOpacity(qreal opacity); | |
52 | qreal labelsOpacity() const; |
|
61 | qreal labelsOpacity() const; | |
53 |
|
62 | |||
54 | void setShadesOpacity(qreal opacity); |
|
63 | void setShadesOpacity(qreal opacity); | |
55 | qreal shadesOpacity() const; |
|
64 | qreal shadesOpacity() const; | |
56 |
|
65 | |||
57 | void setLabelsAngle(int angle); |
|
66 | void setLabelsAngle(int angle); | |
58 | int labelsAngle()const { return m_labelsAngle; } |
|
67 | int labelsAngle()const { return m_labelsAngle; } | |
59 |
|
68 | |||
60 | void setShadesBrush(const QBrush &brush); |
|
69 | void setShadesBrush(const QBrush &brush); | |
61 | void setShadesPen(const QPen &pen); |
|
70 | void setShadesPen(const QPen &pen); | |
62 |
|
71 | |||
63 | void setAxisPen(const QPen &pen); |
|
72 | void setAxisPen(const QPen &pen); | |
64 | void setGridPen(const QPen &pen); |
|
73 | void setGridPen(const QPen &pen); | |
65 |
|
74 | |||
66 | void setLabelsPen(const QPen &pen); |
|
75 | void setLabelsPen(const QPen &pen); | |
67 | void setLabelsBrush(const QBrush &brush); |
|
76 | void setLabelsBrush(const QBrush &brush); | |
68 | void setLabelsFont(const QFont &font); |
|
77 | void setLabelsFont(const QFont &font); | |
69 |
|
78 | |||
70 | void setLayout(QVector<qreal> &layout); |
|
79 | void setLayout(QVector<qreal> &layout); | |
71 | QVector<qreal> layout() const { return m_layoutVector; } |
|
80 | QVector<qreal> layout() const { return m_layoutVector; } | |
72 |
|
81 | |||
73 | void setAnimation(AxisAnimation* animation); |
|
82 | void setAnimation(AxisAnimation* animation); | |
74 | ChartAnimation* animation() const { return m_animation; }; |
|
83 | ChartAnimation* animation() const { return m_animation; }; | |
75 |
|
84 | |||
76 | QRectF geometry() const { return m_rect; } |
|
85 | QRectF geometry() const { return m_rect; } | |
77 |
|
86 | |||
78 | protected: |
|
87 | protected: | |
79 | virtual void updateGeometry() = 0; |
|
88 | virtual void updateGeometry() = 0; | |
80 | virtual QVector<qreal> calculateLayout() const = 0; |
|
89 | virtual QVector<qreal> calculateLayout() const = 0; | |
81 | bool createLabels(QStringList &labels,qreal min, qreal max,int ticks) const; |
|
90 | bool createLabels(QStringList &labels,qreal min, qreal max,int ticks) const; | |
82 |
|
91 | |||
83 | public Q_SLOTS: |
|
92 | public Q_SLOTS: | |
84 | void handleAxisUpdated(); |
|
93 | void handleAxisUpdated(); | |
85 | void handleAxisCategoriesUpdated(); |
|
94 | void handleAxisCategoriesUpdated(); | |
86 | void handleRangeChanged(qreal min , qreal max,int tickCount); |
|
95 | void handleRangeChanged(qreal min , qreal max,int tickCount); | |
87 | void handleGeometryChanged(const QRectF &size); |
|
96 | void handleGeometryChanged(const QRectF &size); | |
88 |
|
97 | |||
89 | private: |
|
98 | private: | |
90 | inline bool isEmpty(); |
|
99 | inline bool isEmpty(); | |
91 | void createItems(int count); |
|
100 | void createItems(int count); | |
92 | void deleteItems(int count); |
|
101 | void deleteItems(int count); | |
93 | void updateLayout(QVector<qreal> &layout); |
|
102 | void updateLayout(QVector<qreal> &layout); | |
94 | void axisSelected(); |
|
103 | void axisSelected(); | |
95 |
|
104 | |||
96 | protected: |
|
105 | protected: | |
97 | QAxis* m_chartAxis; |
|
106 | QAxis* m_chartAxis; | |
98 | QRectF m_rect; |
|
107 | QRectF m_rect; | |
99 | int m_labelsAngle; |
|
108 | int m_labelsAngle; | |
100 | QScopedPointer<QGraphicsItemGroup> m_grid; |
|
109 | QScopedPointer<QGraphicsItemGroup> m_grid; | |
101 | QScopedPointer<QGraphicsItemGroup> m_shades; |
|
110 | QScopedPointer<QGraphicsItemGroup> m_shades; | |
102 | QScopedPointer<QGraphicsItemGroup> m_labels; |
|
111 | QScopedPointer<QGraphicsItemGroup> m_labels; | |
103 | QScopedPointer<QGraphicsItemGroup> m_axis; |
|
112 | QScopedPointer<QGraphicsItemGroup> m_axis; | |
104 | QVector<qreal> m_layoutVector; |
|
113 | QVector<qreal> m_layoutVector; | |
105 | qreal m_min; |
|
114 | qreal m_min; | |
106 | qreal m_max; |
|
115 | qreal m_max; | |
107 | int m_ticksCount; |
|
116 | int m_ticksCount; | |
108 | AxisAnimation *m_animation; |
|
117 | AxisAnimation *m_animation; | |
109 |
|
118 | |||
110 | friend class AxisAnimation; |
|
119 | friend class AxisAnimation; | |
111 | friend class AxisItem; |
|
120 | friend class AxisItem; | |
112 |
|
121 | |||
113 | }; |
|
122 | }; | |
114 |
|
123 | |||
115 | class AxisItem: public QGraphicsLineItem |
|
124 | class AxisItem: public QGraphicsLineItem | |
116 | { |
|
125 | { | |
117 |
|
126 | |||
118 | public: |
|
127 | public: | |
119 | explicit AxisItem(ChartAxis *axis, QGraphicsItem *parent = 0) : QGraphicsLineItem(parent), m_axis(axis) {} |
|
128 | explicit AxisItem(ChartAxis *axis, QGraphicsItem *parent = 0) : QGraphicsLineItem(parent), m_axis(axis) {} | |
120 |
|
129 | |||
121 | protected: |
|
130 | protected: | |
122 | void mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
131 | void mousePressEvent(QGraphicsSceneMouseEvent *event) | |
123 | { |
|
132 | { | |
124 | Q_UNUSED(event) |
|
133 | Q_UNUSED(event) | |
125 | m_axis->axisSelected(); |
|
134 | m_axis->axisSelected(); | |
126 | } |
|
135 | } | |
127 |
|
136 | |||
128 | QRectF boundingRect() const |
|
137 | QRectF boundingRect() const | |
129 | { |
|
138 | { | |
130 | return shape().boundingRect(); |
|
139 | return shape().boundingRect(); | |
131 | } |
|
140 | } | |
132 |
|
141 | |||
133 | QPainterPath shape() const |
|
142 | QPainterPath shape() const | |
134 | { |
|
143 | { | |
135 | QPainterPath path = QGraphicsLineItem::shape(); |
|
144 | QPainterPath path = QGraphicsLineItem::shape(); | |
136 | QRectF rect = path.boundingRect(); |
|
145 | QRectF rect = path.boundingRect(); | |
137 | path.addRect(rect.adjusted(0,0,m_axis->axisType()!=ChartAxis::X_AXIS?8:0,m_axis->axisType()!=ChartAxis::Y_AXIS?8:0)); |
|
146 | path.addRect(rect.adjusted(0,0,m_axis->axisType()!=ChartAxis::X_AXIS?8:0,m_axis->axisType()!=ChartAxis::Y_AXIS?8:0)); | |
138 | return path; |
|
147 | return path; | |
139 | } |
|
148 | } | |
140 |
|
149 | |||
141 | private: |
|
150 | private: | |
142 | ChartAxis* m_axis; |
|
151 | ChartAxis* m_axis; | |
143 |
|
152 | |||
144 | }; |
|
153 | }; | |
145 |
|
154 | |||
146 | QTCOMMERCIALCHART_END_NAMESPACE |
|
155 | QTCOMMERCIALCHART_END_NAMESPACE | |
147 |
|
156 | |||
148 | #endif /* AXISITEM_H_ */ |
|
157 | #endif /* AXISITEM_H_ */ |
@@ -1,46 +1,55 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTAXISX_H |
|
30 | #ifndef CHARTAXISX_H | |
22 | #define CHARTAXISX_H |
|
31 | #define CHARTAXISX_H | |
23 |
|
32 | |||
24 | #include "chartaxis_p.h" |
|
33 | #include "chartaxis_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class QAxis; |
|
37 | class QAxis; | |
29 | class ChartPresenter; |
|
38 | class ChartPresenter; | |
30 |
|
39 | |||
31 | class ChartAxisX : public ChartAxis |
|
40 | class ChartAxisX : public ChartAxis | |
32 | { |
|
41 | { | |
33 | public: |
|
42 | public: | |
34 | ChartAxisX(QAxis *axis, ChartPresenter *presenter); |
|
43 | ChartAxisX(QAxis *axis, ChartPresenter *presenter); | |
35 | ~ChartAxisX(); |
|
44 | ~ChartAxisX(); | |
36 |
|
45 | |||
37 | AxisType axisType() const { return X_AXIS;} |
|
46 | AxisType axisType() const { return X_AXIS;} | |
38 |
|
47 | |||
39 | protected: |
|
48 | protected: | |
40 | QVector<qreal> calculateLayout() const; |
|
49 | QVector<qreal> calculateLayout() const; | |
41 | void updateGeometry(); |
|
50 | void updateGeometry(); | |
42 | }; |
|
51 | }; | |
43 |
|
52 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | QTCOMMERCIALCHART_END_NAMESPACE | |
45 |
|
54 | |||
46 | #endif /* AXISITEM_H_ */ |
|
55 | #endif /* AXISITEM_H_ */ |
@@ -1,46 +1,55 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTAXISY_H |
|
30 | #ifndef CHARTAXISY_H | |
22 | #define CHARTAXISY_H |
|
31 | #define CHARTAXISY_H | |
23 |
|
32 | |||
24 | #include "chartaxis_p.h" |
|
33 | #include "chartaxis_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class QAxis; |
|
37 | class QAxis; | |
29 | class ChartPresenter; |
|
38 | class ChartPresenter; | |
30 |
|
39 | |||
31 | class ChartAxisY : public ChartAxis |
|
40 | class ChartAxisY : public ChartAxis | |
32 | { |
|
41 | { | |
33 | public: |
|
42 | public: | |
34 | ChartAxisY(QAxis *axis, ChartPresenter *presenter); |
|
43 | ChartAxisY(QAxis *axis, ChartPresenter *presenter); | |
35 | ~ChartAxisY(); |
|
44 | ~ChartAxisY(); | |
36 |
|
45 | |||
37 | AxisType axisType() const { return Y_AXIS;} |
|
46 | AxisType axisType() const { return Y_AXIS;} | |
38 |
|
47 | |||
39 | protected: |
|
48 | protected: | |
40 | QVector<qreal> calculateLayout() const; |
|
49 | QVector<qreal> calculateLayout() const; | |
41 | void updateGeometry(); |
|
50 | void updateGeometry(); | |
42 | }; |
|
51 | }; | |
43 |
|
52 | |||
44 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | QTCOMMERCIALCHART_END_NAMESPACE | |
45 |
|
54 | |||
46 | #endif /* AXISITEM_H_ */ |
|
55 | #endif /* AXISITEM_H_ */ |
@@ -1,61 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHART_H |
|
30 | #ifndef CHART_H | |
22 | #define CHART_H |
|
31 | #define CHART_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include <QObject> |
|
34 | #include <QObject> | |
26 | #include <QRect> |
|
35 | #include <QRect> | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class ChartAnimator; |
|
39 | class ChartAnimator; | |
31 | class ChartPresenter; |
|
40 | class ChartPresenter; | |
32 | class ChartAnimation; |
|
41 | class ChartAnimation; | |
33 | class Domain; |
|
42 | class Domain; | |
34 |
|
43 | |||
35 | class Chart: public QObject |
|
44 | class Chart: public QObject | |
36 | { |
|
45 | { | |
37 | Q_OBJECT |
|
46 | Q_OBJECT | |
38 | public: |
|
47 | public: | |
39 | explicit Chart(ChartPresenter *presenter); |
|
48 | explicit Chart(ChartPresenter *presenter); | |
40 |
|
49 | |||
41 | public Q_SLOTS: |
|
50 | public Q_SLOTS: | |
42 | virtual void handleGeometryChanged(const QRectF& rect); |
|
51 | virtual void handleGeometryChanged(const QRectF& rect); | |
43 | virtual void handleDomainChanged(qreal minX,qreal maxX,qreal minY,qreal maxY); |
|
52 | virtual void handleDomainChanged(qreal minX,qreal maxX,qreal minY,qreal maxY); | |
44 |
|
53 | |||
45 | void setAnimator(ChartAnimator* animator); |
|
54 | void setAnimator(ChartAnimator* animator); | |
46 | ChartAnimator* animator() const; |
|
55 | ChartAnimator* animator() const; | |
47 | void setPresenter(ChartPresenter *presenter); |
|
56 | void setPresenter(ChartPresenter *presenter); | |
48 | ChartPresenter* presenter() const; |
|
57 | ChartPresenter* presenter() const; | |
49 | void setDomain(Domain *domain); |
|
58 | void setDomain(Domain *domain); | |
50 | Domain* domain() const; |
|
59 | Domain* domain() const; | |
51 | virtual ChartAnimation* animation() const { return 0; }; |
|
60 | virtual ChartAnimation* animation() const { return 0; }; | |
52 |
|
61 | |||
53 | private: |
|
62 | private: | |
54 | ChartAnimator* m_animator; |
|
63 | ChartAnimator* m_animator; | |
55 | ChartPresenter* m_presenter; |
|
64 | ChartPresenter* m_presenter; | |
56 | Domain* m_domain; |
|
65 | Domain* m_domain; | |
57 | }; |
|
66 | }; | |
58 |
|
67 | |||
59 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
60 |
|
69 | |||
61 | #endif |
|
70 | #endif |
@@ -1,57 +1,66 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTBACKGROUND_H |
|
30 | #ifndef CHARTBACKGROUND_H | |
22 | #define CHARTBACKGROUND_H |
|
31 | #define CHARTBACKGROUND_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include <QGraphicsRectItem> |
|
34 | #include <QGraphicsRectItem> | |
26 |
|
35 | |||
27 | class QGraphicsDropShadowEffect; |
|
36 | class QGraphicsDropShadowEffect; | |
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class ChartBackground: public QGraphicsRectItem |
|
39 | class ChartBackground: public QGraphicsRectItem | |
31 | { |
|
40 | { | |
32 | public: |
|
41 | public: | |
33 | ChartBackground(QGraphicsItem *parent =0); |
|
42 | ChartBackground(QGraphicsItem *parent =0); | |
34 | ~ChartBackground(); |
|
43 | ~ChartBackground(); | |
35 |
|
44 | |||
36 | void setDimeter(int dimater); |
|
45 | void setDimeter(int dimater); | |
37 | int diameter() const; |
|
46 | int diameter() const; | |
38 | void setDropShadowEnabled(bool enabled); |
|
47 | void setDropShadowEnabled(bool enabled); | |
39 | bool isDropShadowEnabled() {return m_dropShadow != 0;} |
|
48 | bool isDropShadowEnabled() {return m_dropShadow != 0;} | |
40 |
|
49 | |||
41 | protected: |
|
50 | protected: | |
42 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
43 |
|
52 | |||
44 |
|
53 | |||
45 | private: |
|
54 | private: | |
46 | int roundness(qreal size) const; |
|
55 | int roundness(qreal size) const; | |
47 |
|
56 | |||
48 | private: |
|
57 | private: | |
49 | int m_diameter; |
|
58 | int m_diameter; | |
50 | QGraphicsDropShadowEffect *m_dropShadow; |
|
59 | QGraphicsDropShadowEffect *m_dropShadow; | |
51 | }; |
|
60 | }; | |
52 |
|
61 | |||
53 | QTCOMMERCIALCHART_END_NAMESPACE |
|
62 | QTCOMMERCIALCHART_END_NAMESPACE | |
54 |
|
63 | |||
55 | #endif /* CHARTBACKGROUND_H_ */ |
|
64 | #endif /* CHARTBACKGROUND_H_ */ | |
56 |
|
65 | |||
57 |
|
66 |
@@ -1,77 +1,86 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTCONFIG_H |
|
30 | #ifndef CHARTCONFIG_H | |
22 | #define CHARTCONFIG_H |
|
31 | #define CHARTCONFIG_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 |
|
34 | |||
26 | #ifdef Q_CC_MSVC |
|
35 | #ifdef Q_CC_MSVC | |
27 | // There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. |
|
36 | // There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. | |
28 | // This is the case at least with shadow builds. |
|
37 | // This is the case at least with shadow builds. | |
29 | // http://qt-project.org/wiki/jom |
|
38 | // http://qt-project.org/wiki/jom | |
30 | #undef DEVELOPMENT_BUILD |
|
39 | #undef DEVELOPMENT_BUILD | |
31 | #endif |
|
40 | #endif | |
32 |
|
41 | |||
33 | #ifndef DEVELOPMENT_BUILD |
|
42 | #ifndef DEVELOPMENT_BUILD | |
34 | const char *buildTime = __TIME__" "__DATE__; |
|
43 | const char *buildTime = __TIME__" "__DATE__; | |
35 | const char *gitHead = "unknown"; |
|
44 | const char *gitHead = "unknown"; | |
36 | #else |
|
45 | #else | |
37 | #include "qchartversion_p.h" |
|
46 | #include "qchartversion_p.h" | |
38 | #endif |
|
47 | #endif | |
39 |
|
48 | |||
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
49 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
41 |
|
50 | |||
42 | class ChartConfig { |
|
51 | class ChartConfig { | |
43 |
|
52 | |||
44 | private: |
|
53 | private: | |
45 | ChartConfig(){ |
|
54 | ChartConfig(){ | |
46 | #if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) |
|
55 | #if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG) | |
47 | qDebug()<<"buildTime" << buildTime; |
|
56 | qDebug()<<"buildTime" << buildTime; | |
48 | qDebug()<<"gitHead" << gitHead; |
|
57 | qDebug()<<"gitHead" << gitHead; | |
49 | #endif |
|
58 | #endif | |
50 | m_instance = this; |
|
59 | m_instance = this; | |
51 | } |
|
60 | } | |
52 | public: |
|
61 | public: | |
53 | static ChartConfig* instance(){ |
|
62 | static ChartConfig* instance(){ | |
54 | if(!m_instance){ |
|
63 | if(!m_instance){ | |
55 | m_instance= new ChartConfig(); |
|
64 | m_instance= new ChartConfig(); | |
56 | } |
|
65 | } | |
57 | return m_instance; |
|
66 | return m_instance; | |
58 | } |
|
67 | } | |
59 |
|
68 | |||
60 | QString compilationTime(){ |
|
69 | QString compilationTime(){ | |
61 | return buildTime; |
|
70 | return buildTime; | |
62 | } |
|
71 | } | |
63 |
|
72 | |||
64 | QString compilationHead(){ |
|
73 | QString compilationHead(){ | |
65 | return gitHead; |
|
74 | return gitHead; | |
66 | } |
|
75 | } | |
67 |
|
76 | |||
68 | private: |
|
77 | private: | |
69 | static ChartConfig* m_instance; |
|
78 | static ChartConfig* m_instance; | |
70 | }; |
|
79 | }; | |
71 |
|
80 | |||
72 |
|
81 | |||
73 | ChartConfig* ChartConfig::m_instance=0; |
|
82 | ChartConfig* ChartConfig::m_instance=0; | |
74 |
|
83 | |||
75 | QTCOMMERCIALCHART_END_NAMESPACE |
|
84 | QTCOMMERCIALCHART_END_NAMESPACE | |
76 |
|
85 | |||
77 | #endif |
|
86 | #endif |
@@ -1,39 +1,48 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTITEM_H |
|
30 | #ifndef CHARTITEM_H | |
22 | #define CHARTITEM_H |
|
31 | #define CHARTITEM_H | |
23 |
|
32 | |||
24 | #include "chart_p.h" |
|
33 | #include "chart_p.h" | |
25 | #include "chartpresenter_p.h" |
|
34 | #include "chartpresenter_p.h" | |
26 | #include <QGraphicsItem> |
|
35 | #include <QGraphicsItem> | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class ChartItem : public QGraphicsItem, public Chart |
|
39 | class ChartItem : public QGraphicsItem, public Chart | |
31 | { |
|
40 | { | |
32 | enum ChartItemTypes{ AXIS_ITEM = UserType + 1, XYLINE_ITEM }; |
|
41 | enum ChartItemTypes{ AXIS_ITEM = UserType + 1, XYLINE_ITEM }; | |
33 | public: |
|
42 | public: | |
34 | ChartItem(ChartPresenter *presenter) : QGraphicsItem(presenter ? presenter->rootItem() : 0), Chart(presenter) {} |
|
43 | ChartItem(ChartPresenter *presenter) : QGraphicsItem(presenter ? presenter->rootItem() : 0), Chart(presenter) {} | |
35 | }; |
|
44 | }; | |
36 |
|
45 | |||
37 | QTCOMMERCIALCHART_END_NAMESPACE |
|
46 | QTCOMMERCIALCHART_END_NAMESPACE | |
38 |
|
47 | |||
39 | #endif /* CHARTITEM_H_ */ |
|
48 | #endif /* CHARTITEM_H_ */ |
@@ -1,145 +1,154 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTPRESENTER_H |
|
30 | #ifndef CHARTPRESENTER_H | |
22 | #define CHARTPRESENTER_H |
|
31 | #define CHARTPRESENTER_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO |
|
34 | #include "qchart.h" //becouse of QChart::ChartThemeId //TODO | |
26 | #include <QRectF> |
|
35 | #include <QRectF> | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class Chart; |
|
39 | class Chart; | |
31 | class QAbstractSeries; |
|
40 | class QAbstractSeries; | |
32 | class ChartDataSet; |
|
41 | class ChartDataSet; | |
33 | class Domain; |
|
42 | class Domain; | |
34 | class ChartAxis; |
|
43 | class ChartAxis; | |
35 | class ChartTheme; |
|
44 | class ChartTheme; | |
36 | class ChartAnimator; |
|
45 | class ChartAnimator; | |
37 | class ChartBackground; |
|
46 | class ChartBackground; | |
38 | class ChartAnimation; |
|
47 | class ChartAnimation; | |
39 |
|
48 | |||
40 | class ChartPresenter: public QObject |
|
49 | class ChartPresenter: public QObject | |
41 | { |
|
50 | { | |
42 | Q_OBJECT |
|
51 | Q_OBJECT | |
43 | public: |
|
52 | public: | |
44 | enum ZValues { |
|
53 | enum ZValues { | |
45 | BackgroundZValue = -1, |
|
54 | BackgroundZValue = -1, | |
46 | ShadesZValue, |
|
55 | ShadesZValue, | |
47 | GridZValue, |
|
56 | GridZValue, | |
48 | SeriesZValue, |
|
57 | SeriesZValue, | |
49 | LineChartZValue = SeriesZValue, |
|
58 | LineChartZValue = SeriesZValue, | |
50 | BarSeriesZValue = SeriesZValue, |
|
59 | BarSeriesZValue = SeriesZValue, | |
51 | ScatterSeriesZValue = SeriesZValue, |
|
60 | ScatterSeriesZValue = SeriesZValue, | |
52 | PieSeriesZValue = SeriesZValue, |
|
61 | PieSeriesZValue = SeriesZValue, | |
53 | AxisZValue, |
|
62 | AxisZValue, | |
54 | LegendZValue |
|
63 | LegendZValue | |
55 | }; |
|
64 | }; | |
56 |
|
65 | |||
57 | enum State { |
|
66 | enum State { | |
58 | ShowState, |
|
67 | ShowState, | |
59 | ScrollUpState, |
|
68 | ScrollUpState, | |
60 | ScrollDownState, |
|
69 | ScrollDownState, | |
61 | ScrollLeftState, |
|
70 | ScrollLeftState, | |
62 | ScrollRightState, |
|
71 | ScrollRightState, | |
63 | ZoomInState, |
|
72 | ZoomInState, | |
64 | ZoomOutState |
|
73 | ZoomOutState | |
65 | }; |
|
74 | }; | |
66 |
|
75 | |||
67 | ChartPresenter(QChart* chart,ChartDataSet *dataset); |
|
76 | ChartPresenter(QChart* chart,ChartDataSet *dataset); | |
68 | virtual ~ChartPresenter(); |
|
77 | virtual ~ChartPresenter(); | |
69 |
|
78 | |||
70 | ChartAnimator* animator() const { return m_animator; } |
|
79 | ChartAnimator* animator() const { return m_animator; } | |
71 | ChartTheme *chartTheme() const { return m_chartTheme; } |
|
80 | ChartTheme *chartTheme() const { return m_chartTheme; } | |
72 | ChartDataSet *dataSet() const { return m_dataset; } |
|
81 | ChartDataSet *dataSet() const { return m_dataset; } | |
73 | QGraphicsItem* rootItem() const { return m_chart; } |
|
82 | QGraphicsItem* rootItem() const { return m_chart; } | |
74 |
|
83 | |||
75 | void setTheme(QChart::ChartTheme theme,bool force = true); |
|
84 | void setTheme(QChart::ChartTheme theme,bool force = true); | |
76 | QChart::ChartTheme theme(); |
|
85 | QChart::ChartTheme theme(); | |
77 |
|
86 | |||
78 | void setAnimationOptions(QChart::AnimationOptions options); |
|
87 | void setAnimationOptions(QChart::AnimationOptions options); | |
79 | QChart::AnimationOptions animationOptions() const; |
|
88 | QChart::AnimationOptions animationOptions() const; | |
80 |
|
89 | |||
81 | void zoomIn(qreal factor); |
|
90 | void zoomIn(qreal factor); | |
82 | void zoomIn(const QRectF& rect); |
|
91 | void zoomIn(const QRectF& rect); | |
83 | void zoomOut(qreal factor); |
|
92 | void zoomOut(qreal factor); | |
84 | void scroll(qreal dx,qreal dy); |
|
93 | void scroll(qreal dx,qreal dy); | |
85 |
|
94 | |||
86 | void setGeometry(const QRectF& rect); |
|
95 | void setGeometry(const QRectF& rect); | |
87 | QRectF chartGeometry() const { return m_chartRect; } |
|
96 | QRectF chartGeometry() const { return m_chartRect; } | |
88 |
|
97 | |||
89 | void setMinimumMarginHeight(ChartAxis* axis, qreal height); |
|
98 | void setMinimumMarginHeight(ChartAxis* axis, qreal height); | |
90 | void setMinimumMarginWidth(ChartAxis* axis, qreal width); |
|
99 | void setMinimumMarginWidth(ChartAxis* axis, qreal width); | |
91 | qreal minimumLeftMargin() const { return m_minLeftMargin; } |
|
100 | qreal minimumLeftMargin() const { return m_minLeftMargin; } | |
92 | qreal minimumBottomMargin() const { return m_minBottomMargin; } |
|
101 | qreal minimumBottomMargin() const { return m_minBottomMargin; } | |
93 |
|
102 | |||
94 | void startAnimation(ChartAnimation* animation); |
|
103 | void startAnimation(ChartAnimation* animation); | |
95 | State state() const { return m_state; } |
|
104 | State state() const { return m_state; } | |
96 | QPointF statePoint() const { return m_statePoint; } |
|
105 | QPointF statePoint() const { return m_statePoint; } | |
97 | public: //TODO: fix me |
|
106 | public: //TODO: fix me | |
98 | void resetAllElements(); |
|
107 | void resetAllElements(); | |
99 | void createChartBackgroundItem(); |
|
108 | void createChartBackgroundItem(); | |
100 | void createChartTitleItem(); |
|
109 | void createChartTitleItem(); | |
101 | QRectF margins() const { return m_chartMargins;} |
|
110 | QRectF margins() const { return m_chartMargins;} | |
102 |
|
111 | |||
103 | public Q_SLOTS: |
|
112 | public Q_SLOTS: | |
104 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); |
|
113 | void handleSeriesAdded(QAbstractSeries* series,Domain* domain); | |
105 | void handleSeriesRemoved(QAbstractSeries* series); |
|
114 | void handleSeriesRemoved(QAbstractSeries* series); | |
106 | void handleAxisAdded(QAxis* axis,Domain* domain); |
|
115 | void handleAxisAdded(QAxis* axis,Domain* domain); | |
107 | void handleAxisRemoved(QAxis* axis); |
|
116 | void handleAxisRemoved(QAxis* axis); | |
108 | void updateLayout(); |
|
117 | void updateLayout(); | |
109 |
|
118 | |||
110 | private Q_SLOTS: |
|
119 | private Q_SLOTS: | |
111 | void handleAnimationFinished(); |
|
120 | void handleAnimationFinished(); | |
112 |
|
121 | |||
113 | Q_SIGNALS: |
|
122 | Q_SIGNALS: | |
114 | void geometryChanged(const QRectF& rect); |
|
123 | void geometryChanged(const QRectF& rect); | |
115 | void animationsFinished(); |
|
124 | void animationsFinished(); | |
116 |
|
125 | |||
117 | private: |
|
126 | private: | |
118 | QChart* m_chart; |
|
127 | QChart* m_chart; | |
119 | ChartAnimator* m_animator; |
|
128 | ChartAnimator* m_animator; | |
120 | ChartDataSet* m_dataset; |
|
129 | ChartDataSet* m_dataset; | |
121 | ChartTheme *m_chartTheme; |
|
130 | ChartTheme *m_chartTheme; | |
122 | QMap<QAbstractSeries *, Chart *> m_chartItems; |
|
131 | QMap<QAbstractSeries *, Chart *> m_chartItems; | |
123 | QMap<QAxis *, ChartAxis *> m_axisItems; |
|
132 | QMap<QAxis *, ChartAxis *> m_axisItems; | |
124 | QRectF m_rect; |
|
133 | QRectF m_rect; | |
125 | QRectF m_chartRect; |
|
134 | QRectF m_chartRect; | |
126 | QChart::AnimationOptions m_options; |
|
135 | QChart::AnimationOptions m_options; | |
127 | qreal m_minLeftMargin; |
|
136 | qreal m_minLeftMargin; | |
128 | qreal m_minBottomMargin; |
|
137 | qreal m_minBottomMargin; | |
129 | State m_state; |
|
138 | State m_state; | |
130 | QPointF m_statePoint; |
|
139 | QPointF m_statePoint; | |
131 | QList<ChartAnimation*> m_animations; |
|
140 | QList<ChartAnimation*> m_animations; | |
132 |
|
141 | |||
133 | public: //TODO: fixme |
|
142 | public: //TODO: fixme | |
134 | ChartBackground* m_backgroundItem; |
|
143 | ChartBackground* m_backgroundItem; | |
135 | QGraphicsSimpleTextItem* m_titleItem; |
|
144 | QGraphicsSimpleTextItem* m_titleItem; | |
136 | int m_marginBig; |
|
145 | int m_marginBig; | |
137 | int m_marginSmall; |
|
146 | int m_marginSmall; | |
138 | int m_marginTiny; |
|
147 | int m_marginTiny; | |
139 | QRectF m_chartMargins; |
|
148 | QRectF m_chartMargins; | |
140 | QRectF m_legendMargins; |
|
149 | QRectF m_legendMargins; | |
141 | }; |
|
150 | }; | |
142 |
|
151 | |||
143 | QTCOMMERCIALCHART_END_NAMESPACE |
|
152 | QTCOMMERCIALCHART_END_NAMESPACE | |
144 |
|
153 | |||
145 | #endif /* CHARTPRESENTER_H_ */ |
|
154 | #endif /* CHARTPRESENTER_H_ */ |
@@ -1,102 +1,111 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEME_H |
|
30 | #ifndef CHARTTHEME_H | |
22 | #define CHARTTHEME_H |
|
31 | #define CHARTTHEME_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "qchart.h" |
|
34 | #include "qchart.h" | |
26 | #include <QColor> |
|
35 | #include <QColor> | |
27 | #include <QGradientStops> |
|
36 | #include <QGradientStops> | |
28 |
|
37 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
39 | |||
31 | class ChartItem; |
|
40 | class ChartItem; | |
32 | class LineChartItem; |
|
41 | class LineChartItem; | |
33 | class QLineSeries; |
|
42 | class QLineSeries; | |
34 | class BarChartItem; |
|
43 | class BarChartItem; | |
35 | class QBarSeries; |
|
44 | class QBarSeries; | |
36 | class StackedBarChartItem; |
|
45 | class StackedBarChartItem; | |
37 | class QStackedBarSeries; |
|
46 | class QStackedBarSeries; | |
38 | class QPercentBarSeries; |
|
47 | class QPercentBarSeries; | |
39 | class PercentBarChartItem; |
|
48 | class PercentBarChartItem; | |
40 | class QScatterSeries; |
|
49 | class QScatterSeries; | |
41 | class ScatterChartItem; |
|
50 | class ScatterChartItem; | |
42 | class PieChartItem; |
|
51 | class PieChartItem; | |
43 | class QPieSeries; |
|
52 | class QPieSeries; | |
44 | class SplineChartItem; |
|
53 | class SplineChartItem; | |
45 | class QSplineSeries; |
|
54 | class QSplineSeries; | |
46 | class AreaChartItem; |
|
55 | class AreaChartItem; | |
47 | class QAreaSeries; |
|
56 | class QAreaSeries; | |
48 |
|
57 | |||
49 | class ChartTheme |
|
58 | class ChartTheme | |
50 | { |
|
59 | { | |
51 | public: |
|
60 | public: | |
52 | enum BackgroundShadesMode { |
|
61 | enum BackgroundShadesMode { | |
53 | BackgroundShadesNone = 0, |
|
62 | BackgroundShadesNone = 0, | |
54 | BackgroundShadesVertical, |
|
63 | BackgroundShadesVertical, | |
55 | BackgroundShadesHorizontal, |
|
64 | BackgroundShadesHorizontal, | |
56 | BackgroundShadesBoth |
|
65 | BackgroundShadesBoth | |
57 | }; |
|
66 | }; | |
58 |
|
67 | |||
59 | protected: |
|
68 | protected: | |
60 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight); |
|
69 | explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight); | |
61 | public: |
|
70 | public: | |
62 | static ChartTheme *createTheme(QChart::ChartTheme theme); |
|
71 | static ChartTheme *createTheme(QChart::ChartTheme theme); | |
63 | QChart::ChartTheme id() const {return m_id;} |
|
72 | QChart::ChartTheme id() const {return m_id;} | |
64 | void decorate(QChart *chart); |
|
73 | void decorate(QChart *chart); | |
65 | void decorate(QLegend *legend); |
|
74 | void decorate(QLegend *legend); | |
66 | void decorate(QBarSeries *series, int index); |
|
75 | void decorate(QBarSeries *series, int index); | |
67 | void decorate(QLineSeries *series, int index); |
|
76 | void decorate(QLineSeries *series, int index); | |
68 | void decorate(QAreaSeries *series, int index); |
|
77 | void decorate(QAreaSeries *series, int index); | |
69 | void decorate(QScatterSeries *series, int index); |
|
78 | void decorate(QScatterSeries *series, int index); | |
70 | void decorate(QPieSeries *series, int index); |
|
79 | void decorate(QPieSeries *series, int index); | |
71 | void decorate(QSplineSeries *series, int index); |
|
80 | void decorate(QSplineSeries *series, int index); | |
72 | void decorate(QAxis *axis, bool axisX); |
|
81 | void decorate(QAxis *axis, bool axisX); | |
73 | void setForced(bool enabled); |
|
82 | void setForced(bool enabled); | |
74 | bool isForced() { return m_force; } |
|
83 | bool isForced() { return m_force; } | |
75 |
|
84 | |||
76 | public: // utils |
|
85 | public: // utils | |
77 | void generateSeriesGradients(); |
|
86 | void generateSeriesGradients(); | |
78 | static QColor colorAt(const QColor &start, const QColor &end, qreal pos); |
|
87 | static QColor colorAt(const QColor &start, const QColor &end, qreal pos); | |
79 | static QColor colorAt(const QGradient &gradient, qreal pos); |
|
88 | static QColor colorAt(const QGradient &gradient, qreal pos); | |
80 |
|
89 | |||
81 | protected: |
|
90 | protected: | |
82 | QChart::ChartTheme m_id; |
|
91 | QChart::ChartTheme m_id; | |
83 | QList<QColor> m_seriesColors; |
|
92 | QList<QColor> m_seriesColors; | |
84 | QList<QGradient> m_seriesGradients; |
|
93 | QList<QGradient> m_seriesGradients; | |
85 | QLinearGradient m_chartBackgroundGradient; |
|
94 | QLinearGradient m_chartBackgroundGradient; | |
86 |
|
95 | |||
87 | QFont m_masterFont; |
|
96 | QFont m_masterFont; | |
88 | QFont m_labelFont; |
|
97 | QFont m_labelFont; | |
89 | QBrush m_titleBrush; |
|
98 | QBrush m_titleBrush; | |
90 | QPen m_axisLinePen; |
|
99 | QPen m_axisLinePen; | |
91 | QBrush m_axisLabelBrush; |
|
100 | QBrush m_axisLabelBrush; | |
92 | QPen m_backgroundShadesPen; |
|
101 | QPen m_backgroundShadesPen; | |
93 | QBrush m_backgroundShadesBrush; |
|
102 | QBrush m_backgroundShadesBrush; | |
94 | BackgroundShadesMode m_backgroundShades; |
|
103 | BackgroundShadesMode m_backgroundShades; | |
95 | bool m_backgroundDropShadowEnabled; |
|
104 | bool m_backgroundDropShadowEnabled; | |
96 | QPen m_gridLinePen; |
|
105 | QPen m_gridLinePen; | |
97 | bool m_force; |
|
106 | bool m_force; | |
98 | }; |
|
107 | }; | |
99 |
|
108 | |||
100 | QTCOMMERCIALCHART_END_NAMESPACE |
|
109 | QTCOMMERCIALCHART_END_NAMESPACE | |
101 |
|
110 | |||
102 | #endif // CHARTTHEME_H |
|
111 | #endif // CHARTTHEME_H |
@@ -1,93 +1,102 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef DOMAIN_H |
|
30 | #ifndef DOMAIN_H | |
22 | #define DOMAIN_H |
|
31 | #define DOMAIN_H | |
23 | #include "qchartglobal.h" |
|
32 | #include "qchartglobal.h" | |
24 | #include <QRectF> |
|
33 | #include <QRectF> | |
25 | #include <QSizeF> |
|
34 | #include <QSizeF> | |
26 | #include <QDebug> |
|
35 | #include <QDebug> | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class QTCOMMERCIALCHART_AUTOTEST_EXPORT Domain: public QObject { |
|
39 | class QTCOMMERCIALCHART_AUTOTEST_EXPORT Domain: public QObject { | |
31 | Q_OBJECT |
|
40 | Q_OBJECT | |
32 | public: |
|
41 | public: | |
33 | explicit Domain(QObject* object=0); |
|
42 | explicit Domain(QObject* object=0); | |
34 | virtual ~Domain(); |
|
43 | virtual ~Domain(); | |
35 |
|
44 | |||
36 | void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
45 | void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
37 | void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY, int tickXCount, int tickYCount); |
|
46 | void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY, int tickXCount, int tickYCount); | |
38 | void setRangeX(qreal min, qreal max); |
|
47 | void setRangeX(qreal min, qreal max); | |
39 | void setRangeX(qreal min, qreal max, int tickCount); |
|
48 | void setRangeX(qreal min, qreal max, int tickCount); | |
40 | void setRangeY(qreal min, qreal max); |
|
49 | void setRangeY(qreal min, qreal max); | |
41 | void setRangeY(qreal min, qreal max, int tickCount); |
|
50 | void setRangeY(qreal min, qreal max, int tickCount); | |
42 | void setMinX(qreal min); |
|
51 | void setMinX(qreal min); | |
43 | void setMaxX(qreal max); |
|
52 | void setMaxX(qreal max); | |
44 | void setMinY(qreal min); |
|
53 | void setMinY(qreal min); | |
45 | void setMaxY(qreal max); |
|
54 | void setMaxY(qreal max); | |
46 |
|
55 | |||
47 | qreal minX() const { return m_minX; } |
|
56 | qreal minX() const { return m_minX; } | |
48 | qreal maxX() const { return m_maxX; } |
|
57 | qreal maxX() const { return m_maxX; } | |
49 | qreal minY() const { return m_minY; } |
|
58 | qreal minY() const { return m_minY; } | |
50 | qreal maxY() const { return m_maxY; } |
|
59 | qreal maxY() const { return m_maxY; } | |
51 |
|
60 | |||
52 | qreal spanX() const; |
|
61 | qreal spanX() const; | |
53 | qreal spanY() const; |
|
62 | qreal spanY() const; | |
54 | bool isEmpty() const; |
|
63 | bool isEmpty() const; | |
55 |
|
64 | |||
56 | int tickXCount() const {return m_tickXCount;} |
|
65 | int tickXCount() const {return m_tickXCount;} | |
57 | int tickYCount() const {return m_tickYCount;} |
|
66 | int tickYCount() const {return m_tickYCount;} | |
58 |
|
67 | |||
59 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const Domain &domain1, const Domain &domain2); |
|
68 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const Domain &domain1, const Domain &domain2); | |
60 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const Domain &domain1, const Domain &domain2); |
|
69 | friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const Domain &domain1, const Domain &domain2); | |
61 | friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const Domain &domain); |
|
70 | friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const Domain &domain); | |
62 |
|
71 | |||
63 | void zoomIn(const QRectF& rect, const QSizeF& size); |
|
72 | void zoomIn(const QRectF& rect, const QSizeF& size); | |
64 | void zoomOut(const QRectF& rect, const QSizeF& size); |
|
73 | void zoomOut(const QRectF& rect, const QSizeF& size); | |
65 | void move(qreal dx,qreal dy,const QSizeF& size); |
|
74 | void move(qreal dx,qreal dy,const QSizeF& size); | |
66 |
|
75 | |||
67 | Q_SIGNALS: |
|
76 | Q_SIGNALS: | |
68 | void domainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
77 | void domainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
69 | void rangeXChanged(qreal min, qreal max, int tickXCount); |
|
78 | void rangeXChanged(qreal min, qreal max, int tickXCount); | |
70 | void rangeYChanged(qreal min, qreal max, int tickYCount); |
|
79 | void rangeYChanged(qreal min, qreal max, int tickYCount); | |
71 |
|
80 | |||
72 | public Q_SLOTS: |
|
81 | public Q_SLOTS: | |
73 | void handleAxisXChanged(qreal min,qreal max,int tickXCount = 5,bool niceNumbers = false); |
|
82 | void handleAxisXChanged(qreal min,qreal max,int tickXCount = 5,bool niceNumbers = false); | |
74 | void handleAxisYChanged(qreal min,qreal max,int tickYCount = 5,bool niceNumbers = false); |
|
83 | void handleAxisYChanged(qreal min,qreal max,int tickYCount = 5,bool niceNumbers = false); | |
75 |
|
84 | |||
76 | private: |
|
85 | private: | |
77 | void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) const; |
|
86 | void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount) const; | |
78 | qreal niceNumber(qreal x,bool celing) const; |
|
87 | qreal niceNumber(qreal x,bool celing) const; | |
79 |
|
88 | |||
80 | private: |
|
89 | private: | |
81 | qreal m_minX; |
|
90 | qreal m_minX; | |
82 | qreal m_maxX; |
|
91 | qreal m_maxX; | |
83 | qreal m_minY; |
|
92 | qreal m_minY; | |
84 | qreal m_maxY; |
|
93 | qreal m_maxY; | |
85 | int m_tickXCount; |
|
94 | int m_tickXCount; | |
86 | int m_tickYCount; |
|
95 | int m_tickYCount; | |
87 | bool m_niceXNumbers; |
|
96 | bool m_niceXNumbers; | |
88 | bool m_niceYNumbers; |
|
97 | bool m_niceYNumbers; | |
89 | }; |
|
98 | }; | |
90 |
|
99 | |||
91 | QTCOMMERCIALCHART_END_NAMESPACE |
|
100 | QTCOMMERCIALCHART_END_NAMESPACE | |
92 |
|
101 | |||
93 | #endif |
|
102 | #endif |
@@ -1,125 +1,134 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef LEGENDMARKER_P_H |
|
30 | #ifndef LEGENDMARKER_P_H | |
22 | #define LEGENDMARKER_P_H |
|
31 | #define LEGENDMARKER_P_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include <QGraphicsObject> |
|
34 | #include <QGraphicsObject> | |
26 | #include <QBrush> |
|
35 | #include <QBrush> | |
27 | #include <QPen> |
|
36 | #include <QPen> | |
28 | #include <QGraphicsSimpleTextItem> |
|
37 | #include <QGraphicsSimpleTextItem> | |
29 |
|
38 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
40 | |||
32 | class QAbstractSeries; |
|
41 | class QAbstractSeries; | |
33 | class QAreaSeries; |
|
42 | class QAreaSeries; | |
34 | class QXYSeries; |
|
43 | class QXYSeries; | |
35 | class QBarSet; |
|
44 | class QBarSet; | |
36 | class QBarSeries; |
|
45 | class QBarSeries; | |
37 | class QPieSlice; |
|
46 | class QPieSlice; | |
38 | class QLegend; |
|
47 | class QLegend; | |
39 | class QPieSeries; |
|
48 | class QPieSeries; | |
40 |
|
49 | |||
41 | class LegendMarker : public QGraphicsObject |
|
50 | class LegendMarker : public QGraphicsObject | |
42 | { |
|
51 | { | |
43 | Q_OBJECT |
|
52 | Q_OBJECT | |
44 |
|
53 | |||
45 | public: |
|
54 | public: | |
46 | explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent); |
|
55 | explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent); | |
47 |
|
56 | |||
48 | void setPen(const QPen &pen); |
|
57 | void setPen(const QPen &pen); | |
49 | QPen pen() const; |
|
58 | QPen pen() const; | |
50 | void setBrush(const QBrush &brush); |
|
59 | void setBrush(const QBrush &brush); | |
51 | QBrush brush() const; |
|
60 | QBrush brush() const; | |
52 |
|
61 | |||
53 | void setSize(const QSize& size); |
|
62 | void setSize(const QSize& size); | |
54 |
|
63 | |||
55 | void setLabel(const QString label); |
|
64 | void setLabel(const QString label); | |
56 | QString label() const; |
|
65 | QString label() const; | |
57 |
|
66 | |||
58 | QAbstractSeries *series() const { return m_series;} |
|
67 | QAbstractSeries *series() const { return m_series;} | |
59 |
|
68 | |||
60 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
69 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | |
61 |
|
70 | |||
62 | QRectF boundingRect() const; |
|
71 | QRectF boundingRect() const; | |
63 |
|
72 | |||
64 | void updateLayout(); |
|
73 | void updateLayout(); | |
65 |
|
74 | |||
66 | protected: |
|
75 | protected: | |
67 | // From QGraphicsObject |
|
76 | // From QGraphicsObject | |
68 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
77 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
69 |
|
78 | |||
70 | public Q_SLOTS: |
|
79 | public Q_SLOTS: | |
71 | virtual void updated() = 0; |
|
80 | virtual void updated() = 0; | |
72 |
|
81 | |||
73 | protected: |
|
82 | protected: | |
74 | QAbstractSeries *m_series; |
|
83 | QAbstractSeries *m_series; | |
75 | QRectF m_markerRect; |
|
84 | QRectF m_markerRect; | |
76 | QRectF m_boundingRect; |
|
85 | QRectF m_boundingRect; | |
77 | QLegend* m_legend; |
|
86 | QLegend* m_legend; | |
78 | QGraphicsSimpleTextItem *m_textItem; |
|
87 | QGraphicsSimpleTextItem *m_textItem; | |
79 | QGraphicsRectItem *m_rectItem; |
|
88 | QGraphicsRectItem *m_rectItem; | |
80 |
|
89 | |||
81 | }; |
|
90 | }; | |
82 |
|
91 | |||
83 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
92 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
84 | class XYLegendMarker : public LegendMarker |
|
93 | class XYLegendMarker : public LegendMarker | |
85 | { |
|
94 | { | |
86 | public: |
|
95 | public: | |
87 | XYLegendMarker(QXYSeries *series, QLegend *legend); |
|
96 | XYLegendMarker(QXYSeries *series, QLegend *legend); | |
88 | protected: |
|
97 | protected: | |
89 | void updated(); |
|
98 | void updated(); | |
90 | private: |
|
99 | private: | |
91 | QXYSeries *m_series; |
|
100 | QXYSeries *m_series; | |
92 | }; |
|
101 | }; | |
93 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
102 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
94 | class AreaLegendMarker : public LegendMarker |
|
103 | class AreaLegendMarker : public LegendMarker | |
95 | { |
|
104 | { | |
96 | public: |
|
105 | public: | |
97 | AreaLegendMarker(QAreaSeries *series, QLegend *legend); |
|
106 | AreaLegendMarker(QAreaSeries *series, QLegend *legend); | |
98 | protected: |
|
107 | protected: | |
99 | void updated(); |
|
108 | void updated(); | |
100 | private: |
|
109 | private: | |
101 | QAreaSeries *m_series; |
|
110 | QAreaSeries *m_series; | |
102 | }; |
|
111 | }; | |
103 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
112 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
104 | class BarLegendMarker : public LegendMarker |
|
113 | class BarLegendMarker : public LegendMarker | |
105 | { |
|
114 | { | |
106 | public: |
|
115 | public: | |
107 | BarLegendMarker(QBarSeries *barseries, QBarSet *barset,QLegend *legend); |
|
116 | BarLegendMarker(QBarSeries *barseries, QBarSet *barset,QLegend *legend); | |
108 | protected: |
|
117 | protected: | |
109 | void updated(); |
|
118 | void updated(); | |
110 | private: |
|
119 | private: | |
111 | QBarSet *m_barset; |
|
120 | QBarSet *m_barset; | |
112 | }; |
|
121 | }; | |
113 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
122 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
114 | class PieLegendMarker : public LegendMarker |
|
123 | class PieLegendMarker : public LegendMarker | |
115 | { |
|
124 | { | |
116 | public: |
|
125 | public: | |
117 | PieLegendMarker(QPieSeries *pieSeries, QPieSlice *pieslice, QLegend *legend); |
|
126 | PieLegendMarker(QPieSeries *pieSeries, QPieSlice *pieslice, QLegend *legend); | |
118 | protected: |
|
127 | protected: | |
119 | void updated(); |
|
128 | void updated(); | |
120 | private: |
|
129 | private: | |
121 | QPieSlice *m_pieslice; |
|
130 | QPieSlice *m_pieslice; | |
122 | }; |
|
131 | }; | |
123 |
|
132 | |||
124 | QTCOMMERCIALCHART_END_NAMESPACE |
|
133 | QTCOMMERCIALCHART_END_NAMESPACE | |
125 | #endif // LEGENDMARKER_P_H |
|
134 | #endif // LEGENDMARKER_P_H |
@@ -1,64 +1,73 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef LINECHARTITEM_H |
|
30 | #ifndef LINECHARTITEM_H | |
22 | #define LINECHARTITEM_H |
|
31 | #define LINECHARTITEM_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "xychart_p.h" |
|
34 | #include "xychart_p.h" | |
26 | #include <QPen> |
|
35 | #include <QPen> | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class QLineSeries; |
|
39 | class QLineSeries; | |
31 | class ChartPresenter; |
|
40 | class ChartPresenter; | |
32 |
|
41 | |||
33 | class LineChartItem : public XYChart , public QGraphicsItem |
|
42 | class LineChartItem : public XYChart , public QGraphicsItem | |
34 | { |
|
43 | { | |
35 | Q_OBJECT |
|
44 | Q_OBJECT | |
36 | Q_INTERFACES(QGraphicsItem) |
|
45 | Q_INTERFACES(QGraphicsItem) | |
37 | public: |
|
46 | public: | |
38 | explicit LineChartItem(QLineSeries *series,ChartPresenter *presenter); |
|
47 | explicit LineChartItem(QLineSeries *series,ChartPresenter *presenter); | |
39 | ~LineChartItem() {}; |
|
48 | ~LineChartItem() {}; | |
40 |
|
49 | |||
41 | //from QGraphicsItem |
|
50 | //from QGraphicsItem | |
42 | QRectF boundingRect() const; |
|
51 | QRectF boundingRect() const; | |
43 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
52 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
44 | QPainterPath shape() const; |
|
53 | QPainterPath shape() const; | |
45 |
|
54 | |||
46 | public Q_SLOTS: |
|
55 | public Q_SLOTS: | |
47 | void handleUpdated(); |
|
56 | void handleUpdated(); | |
48 | protected: |
|
57 | protected: | |
49 | void updateGeometry(); |
|
58 | void updateGeometry(); | |
50 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
59 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
51 |
|
60 | |||
52 | private: |
|
61 | private: | |
53 | QLineSeries* m_series; |
|
62 | QLineSeries* m_series; | |
54 | QPainterPath m_path; |
|
63 | QPainterPath m_path; | |
55 | QRectF m_rect; |
|
64 | QRectF m_rect; | |
56 | QPen m_linePen; |
|
65 | QPen m_linePen; | |
57 | QPen m_pointPen; |
|
66 | QPen m_pointPen; | |
58 | bool m_pointsVisible; |
|
67 | bool m_pointsVisible; | |
59 |
|
68 | |||
60 | }; |
|
69 | }; | |
61 |
|
70 | |||
62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
71 | QTCOMMERCIALCHART_END_NAMESPACE | |
63 |
|
72 | |||
64 | #endif |
|
73 | #endif |
@@ -1,70 +1,79 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef PIECHARTITEM_H |
|
30 | #ifndef PIECHARTITEM_H | |
22 | #define PIECHARTITEM_H |
|
31 | #define PIECHARTITEM_H | |
23 |
|
32 | |||
24 | #include "qpieseries.h" |
|
33 | #include "qpieseries.h" | |
25 | #include "chartitem_p.h" |
|
34 | #include "chartitem_p.h" | |
26 | #include "piesliceitem_p.h" |
|
35 | #include "piesliceitem_p.h" | |
27 |
|
36 | |||
28 | class QGraphicsItem; |
|
37 | class QGraphicsItem; | |
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 | class QPieSlice; |
|
39 | class QPieSlice; | |
31 | class ChartPresenter; |
|
40 | class ChartPresenter; | |
32 |
|
41 | |||
33 | class PieChartItem : public ChartItem |
|
42 | class PieChartItem : public ChartItem | |
34 | { |
|
43 | { | |
35 | Q_OBJECT |
|
44 | Q_OBJECT | |
36 |
|
45 | |||
37 | public: |
|
46 | public: | |
38 | explicit PieChartItem(QPieSeries *series, ChartPresenter *presenter); |
|
47 | explicit PieChartItem(QPieSeries *series, ChartPresenter *presenter); | |
39 | ~PieChartItem(); |
|
48 | ~PieChartItem(); | |
40 |
|
49 | |||
41 | // from QGraphicsItem |
|
50 | // from QGraphicsItem | |
42 | QRectF boundingRect() const { return m_rect; } |
|
51 | QRectF boundingRect() const { return m_rect; } | |
43 | void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {} |
|
52 | void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {} | |
44 |
|
53 | |||
45 | public Q_SLOTS: |
|
54 | public Q_SLOTS: | |
46 | // from Chart |
|
55 | // from Chart | |
47 | virtual void handleGeometryChanged(const QRectF &rect); |
|
56 | virtual void handleGeometryChanged(const QRectF &rect); | |
48 | virtual void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
57 | virtual void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
49 | virtual void rangeXChanged(qreal min, qreal max, int tickXCount); |
|
58 | virtual void rangeXChanged(qreal min, qreal max, int tickXCount); | |
50 | virtual void rangeYChanged(qreal min, qreal max, int tickYCount); |
|
59 | virtual void rangeYChanged(qreal min, qreal max, int tickYCount); | |
51 |
|
60 | |||
52 | void updateLayout(); |
|
61 | void updateLayout(); | |
53 | void handleSlicesAdded(QList<QPieSlice*> slices); |
|
62 | void handleSlicesAdded(QList<QPieSlice*> slices); | |
54 | void handleSlicesRemoved(QList<QPieSlice*> slices); |
|
63 | void handleSlicesRemoved(QList<QPieSlice*> slices); | |
55 | void handleSliceChanged(); |
|
64 | void handleSliceChanged(); | |
56 |
|
65 | |||
57 | private: |
|
66 | private: | |
58 | PieSliceData updateSliceGeometry(QPieSlice *slice); |
|
67 | PieSliceData updateSliceGeometry(QPieSlice *slice); | |
59 |
|
68 | |||
60 | private: |
|
69 | private: | |
61 | QHash<QPieSlice*, PieSliceItem*> m_sliceItems; |
|
70 | QHash<QPieSlice*, PieSliceItem*> m_sliceItems; | |
62 | QPieSeries *m_series; |
|
71 | QPieSeries *m_series; | |
63 | QRectF m_rect; |
|
72 | QRectF m_rect; | |
64 | QPointF m_pieCenter; |
|
73 | QPointF m_pieCenter; | |
65 | qreal m_pieRadius; |
|
74 | qreal m_pieRadius; | |
66 | }; |
|
75 | }; | |
67 |
|
76 | |||
68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
77 | QTCOMMERCIALCHART_END_NAMESPACE | |
69 |
|
78 | |||
70 | #endif // PIECHARTITEM_H |
|
79 | #endif // PIECHARTITEM_H |
@@ -1,130 +1,139 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef PIESLICEDATA_P_H |
|
30 | #ifndef PIESLICEDATA_P_H | |
22 | #define PIESLICEDATA_P_H |
|
31 | #define PIESLICEDATA_P_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "qpieslice.h" |
|
34 | #include "qpieslice.h" | |
26 | #include <QPen> |
|
35 | #include <QPen> | |
27 | #include <QBrush> |
|
36 | #include <QBrush> | |
28 |
|
37 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
39 | |||
31 | template <class T> |
|
40 | template <class T> | |
32 | class Themed : public T |
|
41 | class Themed : public T | |
33 | { |
|
42 | { | |
34 | public: |
|
43 | public: | |
35 | Themed():m_isThemed(true) {} |
|
44 | Themed():m_isThemed(true) {} | |
36 |
|
45 | |||
37 | inline T &operator=(const T &other) { return T::operator =(other); } |
|
46 | inline T &operator=(const T &other) { return T::operator =(other); } | |
38 |
|
47 | |||
39 | inline bool operator!=(const T &other) const { return T::operator !=(other); } |
|
48 | inline bool operator!=(const T &other) const { return T::operator !=(other); } | |
40 | inline bool operator!=(const Themed &other) const |
|
49 | inline bool operator!=(const Themed &other) const | |
41 | { |
|
50 | { | |
42 | if (T::operator !=(other)) |
|
51 | if (T::operator !=(other)) | |
43 | return true; |
|
52 | return true; | |
44 |
|
53 | |||
45 | if (m_isThemed != other.m_isThemed) |
|
54 | if (m_isThemed != other.m_isThemed) | |
46 | return true; |
|
55 | return true; | |
47 |
|
56 | |||
48 | return false; |
|
57 | return false; | |
49 | } |
|
58 | } | |
50 |
|
59 | |||
51 | inline void setThemed(bool state) { m_isThemed = state; } |
|
60 | inline void setThemed(bool state) { m_isThemed = state; } | |
52 | inline bool isThemed() const { return m_isThemed; } |
|
61 | inline bool isThemed() const { return m_isThemed; } | |
53 |
|
62 | |||
54 | private: |
|
63 | private: | |
55 | bool m_isThemed; |
|
64 | bool m_isThemed; | |
56 | }; |
|
65 | }; | |
57 |
|
66 | |||
58 | class PieSliceData |
|
67 | class PieSliceData | |
59 | { |
|
68 | { | |
60 | public: |
|
69 | public: | |
61 | PieSliceData() |
|
70 | PieSliceData() | |
62 | { |
|
71 | { | |
63 | m_value = 0; |
|
72 | m_value = 0; | |
64 |
|
73 | |||
65 | m_isExploded = false; |
|
74 | m_isExploded = false; | |
66 | m_explodeDistanceFactor = 0.15; |
|
75 | m_explodeDistanceFactor = 0.15; | |
67 |
|
76 | |||
68 | m_isLabelVisible = false; |
|
77 | m_isLabelVisible = false; | |
69 | m_labelArmLengthFactor = 0.15; |
|
78 | m_labelArmLengthFactor = 0.15; | |
70 |
|
79 | |||
71 | m_percentage = 0; |
|
80 | m_percentage = 0; | |
72 | m_radius = 0; |
|
81 | m_radius = 0; | |
73 | m_startAngle = 0; |
|
82 | m_startAngle = 0; | |
74 | m_angleSpan = 0; |
|
83 | m_angleSpan = 0; | |
75 | } |
|
84 | } | |
76 |
|
85 | |||
77 | bool operator!=(const PieSliceData &other) const |
|
86 | bool operator!=(const PieSliceData &other) const | |
78 | { |
|
87 | { | |
79 | if (!qFuzzyIsNull(m_value - other.m_value)) |
|
88 | if (!qFuzzyIsNull(m_value - other.m_value)) | |
80 | return true; |
|
89 | return true; | |
81 |
|
90 | |||
82 | if (m_slicePen != other.m_slicePen || |
|
91 | if (m_slicePen != other.m_slicePen || | |
83 | m_sliceBrush != other.m_sliceBrush) |
|
92 | m_sliceBrush != other.m_sliceBrush) | |
84 | return true; |
|
93 | return true; | |
85 |
|
94 | |||
86 | if (m_isExploded != other.m_isExploded || |
|
95 | if (m_isExploded != other.m_isExploded || | |
87 | !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor)) |
|
96 | !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor)) | |
88 | return true; |
|
97 | return true; | |
89 |
|
98 | |||
90 | if (m_isLabelVisible != other.m_isLabelVisible || |
|
99 | if (m_isLabelVisible != other.m_isLabelVisible || | |
91 | m_labelText != other.m_labelText || |
|
100 | m_labelText != other.m_labelText || | |
92 | m_labelFont != other.m_labelFont || |
|
101 | m_labelFont != other.m_labelFont || | |
93 | !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) || |
|
102 | !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) || | |
94 | m_labelBrush != other.m_labelBrush) |
|
103 | m_labelBrush != other.m_labelBrush) | |
95 | return true; |
|
104 | return true; | |
96 |
|
105 | |||
97 | if (!qFuzzyIsNull(m_percentage - other.m_percentage) || |
|
106 | if (!qFuzzyIsNull(m_percentage - other.m_percentage) || | |
98 | m_center != other.m_center || |
|
107 | m_center != other.m_center || | |
99 | !qFuzzyIsNull(m_radius - other.m_radius) || |
|
108 | !qFuzzyIsNull(m_radius - other.m_radius) || | |
100 | !qFuzzyIsNull(m_startAngle - other.m_startAngle) || |
|
109 | !qFuzzyIsNull(m_startAngle - other.m_startAngle) || | |
101 | !qFuzzyIsNull(m_angleSpan - other.m_angleSpan)) |
|
110 | !qFuzzyIsNull(m_angleSpan - other.m_angleSpan)) | |
102 | return true; |
|
111 | return true; | |
103 |
|
112 | |||
104 | return false; |
|
113 | return false; | |
105 | } |
|
114 | } | |
106 |
|
115 | |||
107 | qreal m_value; |
|
116 | qreal m_value; | |
108 |
|
117 | |||
109 | Themed<QPen> m_slicePen; |
|
118 | Themed<QPen> m_slicePen; | |
110 | Themed<QBrush> m_sliceBrush; |
|
119 | Themed<QBrush> m_sliceBrush; | |
111 |
|
120 | |||
112 | bool m_isExploded; |
|
121 | bool m_isExploded; | |
113 | qreal m_explodeDistanceFactor; |
|
122 | qreal m_explodeDistanceFactor; | |
114 |
|
123 | |||
115 | bool m_isLabelVisible; |
|
124 | bool m_isLabelVisible; | |
116 | QString m_labelText; |
|
125 | QString m_labelText; | |
117 | Themed<QFont> m_labelFont; |
|
126 | Themed<QFont> m_labelFont; | |
118 | qreal m_labelArmLengthFactor; |
|
127 | qreal m_labelArmLengthFactor; | |
119 | Themed<QBrush> m_labelBrush; |
|
128 | Themed<QBrush> m_labelBrush; | |
120 |
|
129 | |||
121 | qreal m_percentage; |
|
130 | qreal m_percentage; | |
122 | QPointF m_center; |
|
131 | QPointF m_center; | |
123 | qreal m_radius; |
|
132 | qreal m_radius; | |
124 | qreal m_startAngle; |
|
133 | qreal m_startAngle; | |
125 | qreal m_angleSpan; |
|
134 | qreal m_angleSpan; | |
126 | }; |
|
135 | }; | |
127 |
|
136 | |||
128 | QTCOMMERCIALCHART_END_NAMESPACE |
|
137 | QTCOMMERCIALCHART_END_NAMESPACE | |
129 |
|
138 | |||
130 | #endif // PIESLICEDATA_P_H |
|
139 | #endif // PIESLICEDATA_P_H |
@@ -1,80 +1,89 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef PIESLICEITEM_H |
|
30 | #ifndef PIESLICEITEM_H | |
22 | #define PIESLICEITEM_H |
|
31 | #define PIESLICEITEM_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "charttheme_p.h" |
|
34 | #include "charttheme_p.h" | |
26 | #include "qpieseries.h" |
|
35 | #include "qpieseries.h" | |
27 | #include "pieslicedata_p.h" |
|
36 | #include "pieslicedata_p.h" | |
28 | #include <QGraphicsItem> |
|
37 | #include <QGraphicsItem> | |
29 | #include <QRectF> |
|
38 | #include <QRectF> | |
30 | #include <QColor> |
|
39 | #include <QColor> | |
31 | #include <QPen> |
|
40 | #include <QPen> | |
32 |
|
41 | |||
33 | #define PIESLICE_LABEL_GAP 5 |
|
42 | #define PIESLICE_LABEL_GAP 5 | |
34 |
|
43 | |||
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
44 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
36 | class PieChartItem; |
|
45 | class PieChartItem; | |
37 | class PieSliceLabel; |
|
46 | class PieSliceLabel; | |
38 | class QPieSlice; |
|
47 | class QPieSlice; | |
39 |
|
48 | |||
40 | class PieSliceItem : public QGraphicsObject |
|
49 | class PieSliceItem : public QGraphicsObject | |
41 | { |
|
50 | { | |
42 | Q_OBJECT |
|
51 | Q_OBJECT | |
43 |
|
52 | |||
44 | public: |
|
53 | public: | |
45 | PieSliceItem(QGraphicsItem* parent = 0); |
|
54 | PieSliceItem(QGraphicsItem* parent = 0); | |
46 | ~PieSliceItem(); |
|
55 | ~PieSliceItem(); | |
47 |
|
56 | |||
48 | // from QGraphicsItem |
|
57 | // from QGraphicsItem | |
49 | QRectF boundingRect() const; |
|
58 | QRectF boundingRect() const; | |
50 | QPainterPath shape() const; |
|
59 | QPainterPath shape() const; | |
51 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
60 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
52 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); |
|
61 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | |
53 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
62 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | |
54 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
63 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
55 |
|
64 | |||
56 | void setLayout(const PieSliceData &sliceData); |
|
65 | void setLayout(const PieSliceData &sliceData); | |
57 | static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice); |
|
66 | static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice); | |
58 |
|
67 | |||
59 | Q_SIGNALS: |
|
68 | Q_SIGNALS: | |
60 | void clicked(Qt::MouseButtons buttons); |
|
69 | void clicked(Qt::MouseButtons buttons); | |
61 | void hovered(bool state); |
|
70 | void hovered(bool state); | |
62 |
|
71 | |||
63 | private: |
|
72 | private: | |
64 | void updateGeometry(); |
|
73 | void updateGeometry(); | |
65 | QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart); |
|
74 | QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart); | |
66 | QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart); |
|
75 | QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart); | |
67 | QRectF labelTextRect(QFont font, QString text); |
|
76 | QRectF labelTextRect(QFont font, QString text); | |
68 |
|
77 | |||
69 | private: |
|
78 | private: | |
70 | PieSliceData m_data; |
|
79 | PieSliceData m_data; | |
71 | QRectF m_boundingRect; |
|
80 | QRectF m_boundingRect; | |
72 | QPainterPath m_slicePath; |
|
81 | QPainterPath m_slicePath; | |
73 | QPainterPath m_labelArmPath; |
|
82 | QPainterPath m_labelArmPath; | |
74 | QRectF m_labelTextRect; |
|
83 | QRectF m_labelTextRect; | |
75 | bool m_hovered; |
|
84 | bool m_hovered; | |
76 | }; |
|
85 | }; | |
77 |
|
86 | |||
78 | QTCOMMERCIALCHART_END_NAMESPACE |
|
87 | QTCOMMERCIALCHART_END_NAMESPACE | |
79 |
|
88 | |||
80 | #endif // PIESLICEITEM_H |
|
89 | #endif // PIESLICEITEM_H |
@@ -1,142 +1,151 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef SCATTERCHARTITEM_H |
|
30 | #ifndef SCATTERCHARTITEM_H | |
22 | #define SCATTERCHARTITEM_H |
|
31 | #define SCATTERCHARTITEM_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "xychart_p.h" |
|
34 | #include "xychart_p.h" | |
26 | #include <QGraphicsEllipseItem> |
|
35 | #include <QGraphicsEllipseItem> | |
27 | #include <QPen> |
|
36 | #include <QPen> | |
28 |
|
37 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
39 | |||
31 | class QScatterSeries; |
|
40 | class QScatterSeries; | |
32 | class Marker; |
|
41 | class Marker; | |
33 |
|
42 | |||
34 | class ScatterChartItem : public XYChart, public QGraphicsItem |
|
43 | class ScatterChartItem : public XYChart, public QGraphicsItem | |
35 | { |
|
44 | { | |
36 | Q_OBJECT |
|
45 | Q_OBJECT | |
37 | Q_INTERFACES(QGraphicsItem) |
|
46 | Q_INTERFACES(QGraphicsItem) | |
38 | public: |
|
47 | public: | |
39 | explicit ScatterChartItem(QScatterSeries *series, ChartPresenter *presenter); |
|
48 | explicit ScatterChartItem(QScatterSeries *series, ChartPresenter *presenter); | |
40 |
|
49 | |||
41 | public: |
|
50 | public: | |
42 | //from QGraphicsItem |
|
51 | //from QGraphicsItem | |
43 | QRectF boundingRect() const; |
|
52 | QRectF boundingRect() const; | |
44 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
53 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
45 |
|
54 | |||
46 | void setPen(const QPen &pen); |
|
55 | void setPen(const QPen &pen); | |
47 | void setBrush(const QBrush &brush); |
|
56 | void setBrush(const QBrush &brush); | |
48 |
|
57 | |||
49 | void markerSelected(Marker *item); |
|
58 | void markerSelected(Marker *item); | |
50 |
|
59 | |||
51 | public Q_SLOTS: |
|
60 | public Q_SLOTS: | |
52 | void handleUpdated(); |
|
61 | void handleUpdated(); | |
53 |
|
62 | |||
54 | private: |
|
63 | private: | |
55 | void createPoints(int count); |
|
64 | void createPoints(int count); | |
56 | void deletePoints(int count); |
|
65 | void deletePoints(int count); | |
57 |
|
66 | |||
58 | protected: |
|
67 | protected: | |
59 | void updateGeometry(); |
|
68 | void updateGeometry(); | |
60 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
69 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
61 |
|
70 | |||
62 | private: |
|
71 | private: | |
63 | QScatterSeries *m_series; |
|
72 | QScatterSeries *m_series; | |
64 | QGraphicsItemGroup m_items; |
|
73 | QGraphicsItemGroup m_items; | |
65 | bool m_visible; |
|
74 | bool m_visible; | |
66 | int m_shape; |
|
75 | int m_shape; | |
67 | int m_size; |
|
76 | int m_size; | |
68 | QRectF m_rect; |
|
77 | QRectF m_rect; | |
69 | }; |
|
78 | }; | |
70 |
|
79 | |||
71 |
|
80 | |||
72 | class Marker: public QAbstractGraphicsShapeItem |
|
81 | class Marker: public QAbstractGraphicsShapeItem | |
73 | { |
|
82 | { | |
74 |
|
83 | |||
75 | public: |
|
84 | public: | |
76 |
|
85 | |||
77 | Marker(QAbstractGraphicsShapeItem *item , ScatterChartItem *parent) : QAbstractGraphicsShapeItem(0) ,m_item(item), m_parent(parent) |
|
86 | Marker(QAbstractGraphicsShapeItem *item , ScatterChartItem *parent) : QAbstractGraphicsShapeItem(0) ,m_item(item), m_parent(parent) | |
78 | { |
|
87 | { | |
79 | } |
|
88 | } | |
80 |
|
89 | |||
81 | ~Marker() |
|
90 | ~Marker() | |
82 | { |
|
91 | { | |
83 | delete m_item; |
|
92 | delete m_item; | |
84 | } |
|
93 | } | |
85 |
|
94 | |||
86 | void setPoint(const QPointF& point) |
|
95 | void setPoint(const QPointF& point) | |
87 | { |
|
96 | { | |
88 | m_point=point; |
|
97 | m_point=point; | |
89 | } |
|
98 | } | |
90 |
|
99 | |||
91 | QPointF point() const |
|
100 | QPointF point() const | |
92 | { |
|
101 | { | |
93 | return m_point; |
|
102 | return m_point; | |
94 | } |
|
103 | } | |
95 |
|
104 | |||
96 | QPainterPath shape() const |
|
105 | QPainterPath shape() const | |
97 | { |
|
106 | { | |
98 | return m_item->shape(); |
|
107 | return m_item->shape(); | |
99 | } |
|
108 | } | |
100 |
|
109 | |||
101 | QRectF boundingRect() const |
|
110 | QRectF boundingRect() const | |
102 | { |
|
111 | { | |
103 | return m_item->boundingRect(); |
|
112 | return m_item->boundingRect(); | |
104 | } |
|
113 | } | |
105 |
|
114 | |||
106 | bool contains(const QPointF &point) const |
|
115 | bool contains(const QPointF &point) const | |
107 | { |
|
116 | { | |
108 | return m_item->contains(point); |
|
117 | return m_item->contains(point); | |
109 | } |
|
118 | } | |
110 |
|
119 | |||
111 | void setPen(const QPen &pen) |
|
120 | void setPen(const QPen &pen) | |
112 | { |
|
121 | { | |
113 | m_item->setPen(pen); |
|
122 | m_item->setPen(pen); | |
114 | } |
|
123 | } | |
115 |
|
124 | |||
116 | void setBrush(const QBrush &brush) |
|
125 | void setBrush(const QBrush &brush) | |
117 | { |
|
126 | { | |
118 | m_item->setBrush(brush); |
|
127 | m_item->setBrush(brush); | |
119 | } |
|
128 | } | |
120 |
|
129 | |||
121 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
130 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
122 | { |
|
131 | { | |
123 | m_item->paint(painter,option,widget); |
|
132 | m_item->paint(painter,option,widget); | |
124 | } |
|
133 | } | |
125 |
|
134 | |||
126 | protected: |
|
135 | protected: | |
127 |
|
136 | |||
128 | void mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
137 | void mousePressEvent(QGraphicsSceneMouseEvent *event) | |
129 | { |
|
138 | { | |
130 | Q_UNUSED(event) |
|
139 | Q_UNUSED(event) | |
131 | m_parent->markerSelected(this); |
|
140 | m_parent->markerSelected(this); | |
132 | } |
|
141 | } | |
133 |
|
142 | |||
134 | private: |
|
143 | private: | |
135 | QAbstractGraphicsShapeItem* m_item; |
|
144 | QAbstractGraphicsShapeItem* m_item; | |
136 | ScatterChartItem* m_parent; |
|
145 | ScatterChartItem* m_parent; | |
137 | QPointF m_point; |
|
146 | QPointF m_point; | |
138 | }; |
|
147 | }; | |
139 |
|
148 | |||
140 | QTCOMMERCIALCHART_END_NAMESPACE |
|
149 | QTCOMMERCIALCHART_END_NAMESPACE | |
141 |
|
150 | |||
142 | #endif // SCATTERPRESENTER_H |
|
151 | #endif // SCATTERPRESENTER_H |
@@ -1,74 +1,83 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef SPLINECHARTITEM_P_H |
|
30 | #ifndef SPLINECHARTITEM_P_H | |
22 | #define SPLINECHARTITEM_P_H |
|
31 | #define SPLINECHARTITEM_P_H | |
23 |
|
32 | |||
24 | #include "qsplineseries.h" |
|
33 | #include "qsplineseries.h" | |
25 | #include "xychart_p.h" |
|
34 | #include "xychart_p.h" | |
26 | #include "splineanimation_p.h" |
|
35 | #include "splineanimation_p.h" | |
27 |
|
36 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
38 | |||
30 | class SplineChartItem : public XYChart, public QGraphicsItem |
|
39 | class SplineChartItem : public XYChart, public QGraphicsItem | |
31 | { |
|
40 | { | |
32 | Q_OBJECT |
|
41 | Q_OBJECT | |
33 | Q_INTERFACES(QGraphicsItem) |
|
42 | Q_INTERFACES(QGraphicsItem) | |
34 | public: |
|
43 | public: | |
35 | SplineChartItem(QSplineSeries *series, ChartPresenter *presenter); |
|
44 | SplineChartItem(QSplineSeries *series, ChartPresenter *presenter); | |
36 |
|
45 | |||
37 | //from QGraphicsItem |
|
46 | //from QGraphicsItem | |
38 | QRectF boundingRect() const; |
|
47 | QRectF boundingRect() const; | |
39 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
48 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
40 | QPainterPath shape() const; |
|
49 | QPainterPath shape() const; | |
41 |
|
50 | |||
42 | void setControlGeometryPoints(QVector<QPointF>& points); |
|
51 | void setControlGeometryPoints(QVector<QPointF>& points); | |
43 | QVector<QPointF> controlGeometryPoints() const; |
|
52 | QVector<QPointF> controlGeometryPoints() const; | |
44 |
|
53 | |||
45 | void setAnimation(SplineAnimation* animation); |
|
54 | void setAnimation(SplineAnimation* animation); | |
46 | ChartAnimation* animation() const { return m_animation; } |
|
55 | ChartAnimation* animation() const { return m_animation; } | |
47 |
|
56 | |||
48 | public Q_SLOTS: |
|
57 | public Q_SLOTS: | |
49 | void handleUpdated(); |
|
58 | void handleUpdated(); | |
50 |
|
59 | |||
51 | protected: |
|
60 | protected: | |
52 | void updateGeometry(); |
|
61 | void updateGeometry(); | |
53 | void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints,int index); |
|
62 | void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints,int index); | |
54 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
63 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
55 |
|
64 | |||
56 | private: |
|
65 | private: | |
57 | QPointF calculateGeometryControlPoint(int index) const; |
|
66 | QPointF calculateGeometryControlPoint(int index) const; | |
58 |
|
67 | |||
59 | private: |
|
68 | private: | |
60 | QSplineSeries *m_series; |
|
69 | QSplineSeries *m_series; | |
61 | QPainterPath m_path; |
|
70 | QPainterPath m_path; | |
62 | QRectF m_rect; |
|
71 | QRectF m_rect; | |
63 | QPen m_linePen; |
|
72 | QPen m_linePen; | |
64 | QPen m_pointPen; |
|
73 | QPen m_pointPen; | |
65 | bool m_pointsVisible; |
|
74 | bool m_pointsVisible; | |
66 | QVector<QPointF> m_controlPoints; |
|
75 | QVector<QPointF> m_controlPoints; | |
67 | SplineAnimation* m_animation; |
|
76 | SplineAnimation* m_animation; | |
68 |
|
77 | |||
69 | friend class SplineAnimation; |
|
78 | friend class SplineAnimation; | |
70 | }; |
|
79 | }; | |
71 |
|
80 | |||
72 | QTCOMMERCIALCHART_END_NAMESPACE |
|
81 | QTCOMMERCIALCHART_END_NAMESPACE | |
73 |
|
82 | |||
74 | #endif // SPLINECHARTITEM_P_H |
|
83 | #endif // SPLINECHARTITEM_P_H |
@@ -1,61 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMEBLUECERULEAN_P_H |
|
30 | #ifndef CHARTTHEMEBLUECERULEAN_P_H | |
22 | #define CHARTTHEMEBLUECERULEAN_P_H |
|
31 | #define CHARTTHEMEBLUECERULEAN_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeBlueCerulean: public ChartTheme |
|
37 | class ChartThemeBlueCerulean: public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) |
|
40 | ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0xc7e85b); |
|
43 | m_seriesColors << QRgb(0xc7e85b); | |
35 | m_seriesColors << QRgb(0x1cb54f); |
|
44 | m_seriesColors << QRgb(0x1cb54f); | |
36 | m_seriesColors << QRgb(0x5cbf9b); |
|
45 | m_seriesColors << QRgb(0x5cbf9b); | |
37 | m_seriesColors << QRgb(0x009fbf); |
|
46 | m_seriesColors << QRgb(0x009fbf); | |
38 | m_seriesColors << QRgb(0xee7392); |
|
47 | m_seriesColors << QRgb(0xee7392); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0x056189)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0x056189)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0x101a31)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0x101a31)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 |
|
56 | |||
48 | // Axes and other |
|
57 | // Axes and other | |
49 | m_titleBrush = QBrush(QRgb(0xffffff)); |
|
58 | m_titleBrush = QBrush(QRgb(0xffffff)); | |
50 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
59 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); | |
51 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
52 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); |
|
61 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); | |
53 | m_gridLinePen = QPen(QRgb(0x84a2b0)); |
|
62 | m_gridLinePen = QPen(QRgb(0x84a2b0)); | |
54 | m_gridLinePen.setWidth(1); |
|
63 | m_gridLinePen.setWidth(1); | |
55 | m_backgroundShades = BackgroundShadesNone; |
|
64 | m_backgroundShades = BackgroundShadesNone; | |
56 | } |
|
65 | } | |
57 | }; |
|
66 | }; | |
58 |
|
67 | |||
59 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
60 |
|
69 | |||
61 | #endif |
|
70 | #endif |
@@ -1,62 +1,71 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMEBLUEICY_P_H |
|
30 | #ifndef CHARTTHEMEBLUEICY_P_H | |
22 | #define CHARTTHEMEBLUEICY_P_H |
|
31 | #define CHARTTHEMEBLUEICY_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeBlueIcy: public ChartTheme |
|
37 | class ChartThemeBlueIcy: public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy) |
|
40 | ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0x3daeda); |
|
43 | m_seriesColors << QRgb(0x3daeda); | |
35 | m_seriesColors << QRgb(0x2685bf); |
|
44 | m_seriesColors << QRgb(0x2685bf); | |
36 | m_seriesColors << QRgb(0x0c2673); |
|
45 | m_seriesColors << QRgb(0x0c2673); | |
37 | m_seriesColors << QRgb(0x5f3dba); |
|
46 | m_seriesColors << QRgb(0x5f3dba); | |
38 | m_seriesColors << QRgb(0x2fa3b4); |
|
47 | m_seriesColors << QRgb(0x2fa3b4); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 | m_backgroundDropShadowEnabled = true; |
|
56 | m_backgroundDropShadowEnabled = true; | |
48 |
|
57 | |||
49 | // Axes and other |
|
58 | // Axes and other | |
50 | m_titleBrush = QBrush(QRgb(0x404044)); |
|
59 | m_titleBrush = QBrush(QRgb(0x404044)); | |
51 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
60 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); | |
52 | m_axisLinePen.setWidth(2); |
|
61 | m_axisLinePen.setWidth(2); | |
53 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
62 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
54 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
63 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
55 | m_gridLinePen.setWidth(1); |
|
64 | m_gridLinePen.setWidth(1); | |
56 | m_backgroundShades = BackgroundShadesNone; |
|
65 | m_backgroundShades = BackgroundShadesNone; | |
57 | } |
|
66 | } | |
58 | }; |
|
67 | }; | |
59 |
|
68 | |||
60 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
61 |
|
70 | |||
62 | #endif |
|
71 | #endif |
@@ -1,61 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMEBLUENCS_P_H |
|
30 | #ifndef CHARTTHEMEBLUENCS_P_H | |
22 | #define CHARTTHEMEBLUENCS_P_H |
|
31 | #define CHARTTHEMEBLUENCS_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeBlueNcs: public ChartTheme |
|
37 | class ChartThemeBlueNcs: public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs) |
|
40 | ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0x1db0da); |
|
43 | m_seriesColors << QRgb(0x1db0da); | |
35 | m_seriesColors << QRgb(0x1341a6); |
|
44 | m_seriesColors << QRgb(0x1341a6); | |
36 | m_seriesColors << QRgb(0x88d41e); |
|
45 | m_seriesColors << QRgb(0x88d41e); | |
37 | m_seriesColors << QRgb(0xff8e1a); |
|
46 | m_seriesColors << QRgb(0xff8e1a); | |
38 | m_seriesColors << QRgb(0x398ca3); |
|
47 | m_seriesColors << QRgb(0x398ca3); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient; |
|
51 | QLinearGradient backgroundGradient; | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 |
|
56 | |||
48 | // Axes and other |
|
57 | // Axes and other | |
49 | m_titleBrush = QBrush(QRgb(0x404044)); |
|
58 | m_titleBrush = QBrush(QRgb(0x404044)); | |
50 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); |
|
59 | m_axisLinePen = QPen(QRgb(0xd6d6d6)); | |
51 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
52 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
61 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
53 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
62 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
54 | m_gridLinePen.setWidth(1); |
|
63 | m_gridLinePen.setWidth(1); | |
55 | m_backgroundShades = BackgroundShadesNone; |
|
64 | m_backgroundShades = BackgroundShadesNone; | |
56 | } |
|
65 | } | |
57 | }; |
|
66 | }; | |
58 |
|
67 | |||
59 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
60 |
|
69 | |||
61 | #endif |
|
70 | #endif |
@@ -1,61 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMEBROWNSAND_P_H |
|
30 | #ifndef CHARTTHEMEBROWNSAND_P_H | |
22 | #define CHARTTHEMEBROWNSAND_P_H |
|
31 | #define CHARTTHEMEBROWNSAND_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeBrownSand: public ChartTheme |
|
37 | class ChartThemeBrownSand: public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand) |
|
40 | ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0xb39b72); |
|
43 | m_seriesColors << QRgb(0xb39b72); | |
35 | m_seriesColors << QRgb(0xb3b376); |
|
44 | m_seriesColors << QRgb(0xb3b376); | |
36 | m_seriesColors << QRgb(0xc35660); |
|
45 | m_seriesColors << QRgb(0xc35660); | |
37 | m_seriesColors << QRgb(0x536780); |
|
46 | m_seriesColors << QRgb(0x536780); | |
38 | m_seriesColors << QRgb(0x494345); |
|
47 | m_seriesColors << QRgb(0x494345); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient; |
|
51 | QLinearGradient backgroundGradient; | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 |
|
56 | |||
48 | // Axes and other |
|
57 | // Axes and other | |
49 | m_titleBrush = QBrush(QRgb(0x404044)); |
|
58 | m_titleBrush = QBrush(QRgb(0x404044)); | |
50 | m_axisLinePen = QPen(QRgb(0xb5b0a7)); |
|
59 | m_axisLinePen = QPen(QRgb(0xb5b0a7)); | |
51 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
52 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
61 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
53 | m_gridLinePen = QPen(QRgb(0xd4cec3)); |
|
62 | m_gridLinePen = QPen(QRgb(0xd4cec3)); | |
54 | m_gridLinePen.setWidth(1); |
|
63 | m_gridLinePen.setWidth(1); | |
55 | m_backgroundShades = BackgroundShadesNone; |
|
64 | m_backgroundShades = BackgroundShadesNone; | |
56 | } |
|
65 | } | |
57 | }; |
|
66 | }; | |
58 |
|
67 | |||
59 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
60 |
|
69 | |||
61 | #endif |
|
70 | #endif |
@@ -1,61 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMEDARK_P_H |
|
30 | #ifndef CHARTTHEMEDARK_P_H | |
22 | #define CHARTTHEMEDARK_P_H |
|
31 | #define CHARTTHEMEDARK_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeDark : public ChartTheme |
|
37 | class ChartThemeDark : public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeDark() : ChartTheme(QChart::ChartThemeDark) |
|
40 | ChartThemeDark() : ChartTheme(QChart::ChartThemeDark) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0x38ad6b); |
|
43 | m_seriesColors << QRgb(0x38ad6b); | |
35 | m_seriesColors << QRgb(0x3c84a7); |
|
44 | m_seriesColors << QRgb(0x3c84a7); | |
36 | m_seriesColors << QRgb(0xeb8817); |
|
45 | m_seriesColors << QRgb(0xeb8817); | |
37 | m_seriesColors << QRgb(0x7b7f8c); |
|
46 | m_seriesColors << QRgb(0x7b7f8c); | |
38 | m_seriesColors << QRgb(0xbf593e); |
|
47 | m_seriesColors << QRgb(0xbf593e); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0x2e303a)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0x2e303a)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 |
|
56 | |||
48 | // Axes and other |
|
57 | // Axes and other | |
49 | m_titleBrush = QBrush(QRgb(0xffffff)); |
|
58 | m_titleBrush = QBrush(QRgb(0xffffff)); | |
50 | m_axisLinePen = QPen(QRgb(0x86878c)); |
|
59 | m_axisLinePen = QPen(QRgb(0x86878c)); | |
51 | m_axisLinePen.setWidth(2); |
|
60 | m_axisLinePen.setWidth(2); | |
52 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); |
|
61 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); | |
53 | m_gridLinePen = QPen(QRgb(0x86878c)); |
|
62 | m_gridLinePen = QPen(QRgb(0x86878c)); | |
54 | m_gridLinePen.setWidth(1); |
|
63 | m_gridLinePen.setWidth(1); | |
55 | m_backgroundShades = BackgroundShadesNone; |
|
64 | m_backgroundShades = BackgroundShadesNone; | |
56 | } |
|
65 | } | |
57 | }; |
|
66 | }; | |
58 |
|
67 | |||
59 | QTCOMMERCIALCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE | |
60 |
|
69 | |||
61 | #endif |
|
70 | #endif |
@@ -1,63 +1,72 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMEHIGHCONTRAST_P_H |
|
30 | #ifndef CHARTTHEMEHIGHCONTRAST_P_H | |
22 | #define CHARTTHEMEHIGHCONTRAST_P_H |
|
31 | #define CHARTTHEMEHIGHCONTRAST_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeHighContrast : public ChartTheme |
|
37 | class ChartThemeHighContrast : public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast) |
|
40 | ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0x202020); |
|
43 | m_seriesColors << QRgb(0x202020); | |
35 | m_seriesColors << QRgb(0x596a74); |
|
44 | m_seriesColors << QRgb(0x596a74); | |
36 | m_seriesColors << QRgb(0xffab03); |
|
45 | m_seriesColors << QRgb(0xffab03); | |
37 | m_seriesColors << QRgb(0x038e9b); |
|
46 | m_seriesColors << QRgb(0x038e9b); | |
38 | m_seriesColors << QRgb(0xff4a41); |
|
47 | m_seriesColors << QRgb(0xff4a41); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); |
|
51 | QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0); | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 | m_backgroundDropShadowEnabled = true; |
|
56 | m_backgroundDropShadowEnabled = true; | |
48 |
|
57 | |||
49 | // Axes and other |
|
58 | // Axes and other | |
50 | m_titleBrush = QBrush(QRgb(0x181818)); |
|
59 | m_titleBrush = QBrush(QRgb(0x181818)); | |
51 | m_axisLinePen = QPen(QRgb(0x8c8c8c)); |
|
60 | m_axisLinePen = QPen(QRgb(0x8c8c8c)); | |
52 | m_axisLinePen.setWidth(2); |
|
61 | m_axisLinePen.setWidth(2); | |
53 | m_axisLabelBrush = QBrush(QRgb(0x181818)); |
|
62 | m_axisLabelBrush = QBrush(QRgb(0x181818)); | |
54 | m_gridLinePen = QPen(QRgb(0x8c8c8c)); |
|
63 | m_gridLinePen = QPen(QRgb(0x8c8c8c)); | |
55 | m_gridLinePen.setWidth(1); |
|
64 | m_gridLinePen.setWidth(1); | |
56 | m_backgroundShadesBrush = QBrush(QRgb(0xffeecd)); |
|
65 | m_backgroundShadesBrush = QBrush(QRgb(0xffeecd)); | |
57 | m_backgroundShades = BackgroundShadesHorizontal; |
|
66 | m_backgroundShades = BackgroundShadesHorizontal; | |
58 | } |
|
67 | } | |
59 | }; |
|
68 | }; | |
60 |
|
69 | |||
61 | QTCOMMERCIALCHART_END_NAMESPACE |
|
70 | QTCOMMERCIALCHART_END_NAMESPACE | |
62 |
|
71 | |||
63 | #endif |
|
72 | #endif |
@@ -1,62 +1,71 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMELIGHT_P_H |
|
30 | #ifndef CHARTTHEMELIGHT_P_H | |
22 | #define CHARTTHEMELIGHT_P_H |
|
31 | #define CHARTTHEMELIGHT_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 |
|
34 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
36 | |||
28 | class ChartThemeLight: public ChartTheme |
|
37 | class ChartThemeLight: public ChartTheme | |
29 | { |
|
38 | { | |
30 | public: |
|
39 | public: | |
31 | ChartThemeLight() : ChartTheme(QChart::ChartThemeLight) |
|
40 | ChartThemeLight() : ChartTheme(QChart::ChartThemeLight) | |
32 | { |
|
41 | { | |
33 | // Series colors |
|
42 | // Series colors | |
34 | m_seriesColors << QRgb(0x209fdf); |
|
43 | m_seriesColors << QRgb(0x209fdf); | |
35 | m_seriesColors << QRgb(0x99ca53); |
|
44 | m_seriesColors << QRgb(0x99ca53); | |
36 | m_seriesColors << QRgb(0xf6a625); |
|
45 | m_seriesColors << QRgb(0xf6a625); | |
37 | m_seriesColors << QRgb(0x6d5fd5); |
|
46 | m_seriesColors << QRgb(0x6d5fd5); | |
38 | m_seriesColors << QRgb(0xbf593e); |
|
47 | m_seriesColors << QRgb(0xbf593e); | |
39 | generateSeriesGradients(); |
|
48 | generateSeriesGradients(); | |
40 |
|
49 | |||
41 | // Background |
|
50 | // Background | |
42 | QLinearGradient backgroundGradient; |
|
51 | QLinearGradient backgroundGradient; | |
43 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
52 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
44 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
53 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
45 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
54 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
46 | m_chartBackgroundGradient = backgroundGradient; |
|
55 | m_chartBackgroundGradient = backgroundGradient; | |
47 | // There is a performance issue in the drop shadow implementation, so disabled for now |
|
56 | // There is a performance issue in the drop shadow implementation, so disabled for now | |
48 | // m_backgroundDropShadowEnabled = true; |
|
57 | // m_backgroundDropShadowEnabled = true; | |
49 |
|
58 | |||
50 | // Axes and other |
|
59 | // Axes and other | |
51 | m_axisLinePen = QPen(0xd6d6d6); |
|
60 | m_axisLinePen = QPen(0xd6d6d6); | |
52 | m_axisLinePen.setWidth(1); |
|
61 | m_axisLinePen.setWidth(1); | |
53 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
62 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
54 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
63 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
55 | m_gridLinePen.setWidth(1); |
|
64 | m_gridLinePen.setWidth(1); | |
56 | m_backgroundShades = BackgroundShadesNone; |
|
65 | m_backgroundShades = BackgroundShadesNone; | |
57 | } |
|
66 | } | |
58 | }; |
|
67 | }; | |
59 |
|
68 | |||
60 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
61 |
|
70 | |||
62 | #endif |
|
71 | #endif |
@@ -1,171 +1,180 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef CHARTTHEMESYSTEM_P_H |
|
30 | #ifndef CHARTTHEMESYSTEM_P_H | |
22 | #define CHARTTHEMESYSTEM_P_H |
|
31 | #define CHARTTHEMESYSTEM_P_H | |
23 |
|
32 | |||
24 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
25 | #ifdef Q_OS_WIN |
|
34 | #ifdef Q_OS_WIN | |
26 | #include <windows.h> |
|
35 | #include <windows.h> | |
27 | #include <stdio.h> |
|
36 | #include <stdio.h> | |
28 | #endif |
|
37 | #endif | |
29 |
|
38 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
40 | |||
32 | class ChartThemeSystem: public ChartTheme |
|
41 | class ChartThemeSystem: public ChartTheme | |
33 | { |
|
42 | { | |
34 | public: |
|
43 | public: | |
35 | // System theme not used at the moment (the user is not able to select this theme) |
|
44 | // System theme not used at the moment (the user is not able to select this theme) | |
36 | ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/) |
|
45 | ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/) | |
37 | { |
|
46 | { | |
38 | #ifdef Q_OS_WIN |
|
47 | #ifdef Q_OS_WIN | |
39 | // TODO: use theme specific window frame color as a series base color (it would give more |
|
48 | // TODO: use theme specific window frame color as a series base color (it would give more | |
40 | // variation to the base colors in addition to the blue and black used now) |
|
49 | // variation to the base colors in addition to the blue and black used now) | |
41 | // TODO: COLOR_WINDOWTEXT for text color? |
|
50 | // TODO: COLOR_WINDOWTEXT for text color? | |
42 | // TODO: COLOR_INFOTEXT for tooltip text color? |
|
51 | // TODO: COLOR_INFOTEXT for tooltip text color? | |
43 | // TODO: COLOR_INFOBK for tooltip background color? |
|
52 | // TODO: COLOR_INFOBK for tooltip background color? | |
44 |
|
53 | |||
45 | // First series base color from COLOR_HIGHLIGHT |
|
54 | // First series base color from COLOR_HIGHLIGHT | |
46 | DWORD colorHighlight; |
|
55 | DWORD colorHighlight; | |
47 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); |
|
56 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); | |
48 | m_seriesColors.append(QColor(GetRValue(colorHighlight), |
|
57 | m_seriesColors.append(QColor(GetRValue(colorHighlight), | |
49 | GetGValue(colorHighlight), |
|
58 | GetGValue(colorHighlight), | |
50 | GetBValue(colorHighlight))); |
|
59 | GetBValue(colorHighlight))); | |
51 |
|
60 | |||
52 | // Second series base color from COLOR_WINDOWFRAME |
|
61 | // Second series base color from COLOR_WINDOWFRAME | |
53 | DWORD colorWindowFrame; |
|
62 | DWORD colorWindowFrame; | |
54 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); |
|
63 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); | |
55 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), |
|
64 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), | |
56 | GetGValue(colorWindowFrame), |
|
65 | GetGValue(colorWindowFrame), | |
57 | GetBValue(colorWindowFrame))); |
|
66 | GetBValue(colorWindowFrame))); | |
58 |
|
67 | |||
59 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / |
|
68 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / | |
60 | // COLOR_GRADIENTACTIVECAPTION gradient |
|
69 | // COLOR_GRADIENTACTIVECAPTION gradient | |
61 | DWORD colorGradientActiveCaptionLeft; |
|
70 | DWORD colorGradientActiveCaptionLeft; | |
62 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); |
|
71 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); | |
63 | DWORD colorGradientActiveCaptionRight; |
|
72 | DWORD colorGradientActiveCaptionRight; | |
64 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); |
|
73 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); | |
65 | QLinearGradient g; |
|
74 | QLinearGradient g; | |
66 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), |
|
75 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), | |
67 | GetGValue(colorGradientActiveCaptionLeft), |
|
76 | GetGValue(colorGradientActiveCaptionLeft), | |
68 | GetBValue(colorGradientActiveCaptionLeft)); |
|
77 | GetBValue(colorGradientActiveCaptionLeft)); | |
69 | g.setColorAt(0.0, start); |
|
78 | g.setColorAt(0.0, start); | |
70 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), |
|
79 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), | |
71 | GetGValue(colorGradientActiveCaptionRight), |
|
80 | GetGValue(colorGradientActiveCaptionRight), | |
72 | GetBValue(colorGradientActiveCaptionRight)); |
|
81 | GetBValue(colorGradientActiveCaptionRight)); | |
73 | g.setColorAt(1.0, end); |
|
82 | g.setColorAt(1.0, end); | |
74 | m_seriesColors.append(colorAt(g, 0.5)); |
|
83 | m_seriesColors.append(colorAt(g, 0.5)); | |
75 |
|
84 | |||
76 | // Generate gradients from the base colors |
|
85 | // Generate gradients from the base colors | |
77 | generateSeriesGradients(); |
|
86 | generateSeriesGradients(); | |
78 |
|
87 | |||
79 | // Background fill color from COLOR_WINDOW |
|
88 | // Background fill color from COLOR_WINDOW | |
80 | QLinearGradient backgroundGradient; |
|
89 | QLinearGradient backgroundGradient; | |
81 | DWORD colorWindow; |
|
90 | DWORD colorWindow; | |
82 | colorWindow = GetSysColor(COLOR_WINDOW); |
|
91 | colorWindow = GetSysColor(COLOR_WINDOW); | |
83 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), |
|
92 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), | |
84 | GetGValue(colorWindow), |
|
93 | GetGValue(colorWindow), | |
85 | GetBValue(colorWindow))); |
|
94 | GetBValue(colorWindow))); | |
86 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), |
|
95 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), | |
87 | GetGValue(colorWindow), |
|
96 | GetGValue(colorWindow), | |
88 | GetBValue(colorWindow))); |
|
97 | GetBValue(colorWindow))); | |
89 | // Axes and other |
|
98 | // Axes and other | |
90 | m_axisLinePen = QPen(0xd6d6d6); |
|
99 | m_axisLinePen = QPen(0xd6d6d6); | |
91 | m_axisLinePen.setWidth(1); |
|
100 | m_axisLinePen.setWidth(1); | |
92 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
101 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
93 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
102 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
94 | m_gridLinePen.setWidth(1); |
|
103 | m_gridLinePen.setWidth(1); | |
95 | m_backgroundShades = BackgroundShadesNone; |
|
104 | m_backgroundShades = BackgroundShadesNone; | |
96 |
|
105 | |||
97 | #elif defined(Q_OS_LINUX) |
|
106 | #elif defined(Q_OS_LINUX) | |
98 | // TODO: replace this dummy theme with linux specific theme |
|
107 | // TODO: replace this dummy theme with linux specific theme | |
99 | m_seriesColors << QRgb(0x60a6e6); |
|
108 | m_seriesColors << QRgb(0x60a6e6); | |
100 | m_seriesColors << QRgb(0x92ca66); |
|
109 | m_seriesColors << QRgb(0x92ca66); | |
101 | m_seriesColors << QRgb(0xeba85f); |
|
110 | m_seriesColors << QRgb(0xeba85f); | |
102 | m_seriesColors << QRgb(0xfc5751); |
|
111 | m_seriesColors << QRgb(0xfc5751); | |
103 | generateSeriesGradients(); |
|
112 | generateSeriesGradients(); | |
104 |
|
113 | |||
105 | // Background |
|
114 | // Background | |
106 | QLinearGradient backgroundGradient; |
|
115 | QLinearGradient backgroundGradient; | |
107 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
116 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
108 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
117 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
109 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
118 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
110 | m_chartBackgroundGradient = backgroundGradient; |
|
119 | m_chartBackgroundGradient = backgroundGradient; | |
111 |
|
120 | |||
112 | // Axes and other |
|
121 | // Axes and other | |
113 | m_axisLinePen = QPen(0xd6d6d6); |
|
122 | m_axisLinePen = QPen(0xd6d6d6); | |
114 | m_axisLinePen.setWidth(1); |
|
123 | m_axisLinePen.setWidth(1); | |
115 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
124 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
116 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
125 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
117 | m_gridLinePen.setWidth(1); |
|
126 | m_gridLinePen.setWidth(1); | |
118 | m_backgroundShades = BackgroundShadesNone; |
|
127 | m_backgroundShades = BackgroundShadesNone; | |
119 |
|
128 | |||
120 | #elif defined(Q_OS_MAC) |
|
129 | #elif defined(Q_OS_MAC) | |
121 | // TODO: replace this dummy theme with OSX specific theme |
|
130 | // TODO: replace this dummy theme with OSX specific theme | |
122 | m_seriesColors << QRgb(0x60a6e6); |
|
131 | m_seriesColors << QRgb(0x60a6e6); | |
123 | m_seriesColors << QRgb(0x92ca66); |
|
132 | m_seriesColors << QRgb(0x92ca66); | |
124 | m_seriesColors << QRgb(0xeba85f); |
|
133 | m_seriesColors << QRgb(0xeba85f); | |
125 | m_seriesColors << QRgb(0xfc5751); |
|
134 | m_seriesColors << QRgb(0xfc5751); | |
126 | generateSeriesGradients(); |
|
135 | generateSeriesGradients(); | |
127 |
|
136 | |||
128 | // Background |
|
137 | // Background | |
129 | QLinearGradient backgroundGradient; |
|
138 | QLinearGradient backgroundGradient; | |
130 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
139 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
131 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
140 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
132 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
141 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
133 | m_chartBackgroundGradient = backgroundGradient; |
|
142 | m_chartBackgroundGradient = backgroundGradient; | |
134 |
|
143 | |||
135 | // Axes and other |
|
144 | // Axes and other | |
136 | m_axisLinePen = QPen(0xd6d6d6); |
|
145 | m_axisLinePen = QPen(0xd6d6d6); | |
137 | m_axisLinePen.setWidth(1); |
|
146 | m_axisLinePen.setWidth(1); | |
138 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
147 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
139 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
148 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
140 | m_gridLinePen.setWidth(1); |
|
149 | m_gridLinePen.setWidth(1); | |
141 | m_backgroundShades = BackgroundShadesNone; |
|
150 | m_backgroundShades = BackgroundShadesNone; | |
142 |
|
151 | |||
143 | #else |
|
152 | #else | |
144 | // TODO: replace this dummy theme with generic (not OS specific) theme |
|
153 | // TODO: replace this dummy theme with generic (not OS specific) theme | |
145 | m_seriesColors << QRgb(0x60a6e6); |
|
154 | m_seriesColors << QRgb(0x60a6e6); | |
146 | m_seriesColors << QRgb(0x92ca66); |
|
155 | m_seriesColors << QRgb(0x92ca66); | |
147 | m_seriesColors << QRgb(0xeba85f); |
|
156 | m_seriesColors << QRgb(0xeba85f); | |
148 | m_seriesColors << QRgb(0xfc5751); |
|
157 | m_seriesColors << QRgb(0xfc5751); | |
149 | generateSeriesGradients(); |
|
158 | generateSeriesGradients(); | |
150 |
|
159 | |||
151 | // Background |
|
160 | // Background | |
152 | QLinearGradient backgroundGradient; |
|
161 | QLinearGradient backgroundGradient; | |
153 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
162 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
154 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
163 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
155 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
164 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
156 | m_chartBackgroundGradient = backgroundGradient; |
|
165 | m_chartBackgroundGradient = backgroundGradient; | |
157 |
|
166 | |||
158 | // Axes and other |
|
167 | // Axes and other | |
159 | m_axisLinePen = QPen(0xd6d6d6); |
|
168 | m_axisLinePen = QPen(0xd6d6d6); | |
160 | m_axisLinePen.setWidth(1); |
|
169 | m_axisLinePen.setWidth(1); | |
161 | m_axisLabelBrush = QBrush(QRgb(0x404044)); |
|
170 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
162 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
171 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
163 | m_gridLinePen.setWidth(1); |
|
172 | m_gridLinePen.setWidth(1); | |
164 | m_backgroundShades = BackgroundShadesNone; |
|
173 | m_backgroundShades = BackgroundShadesNone; | |
165 | #endif |
|
174 | #endif | |
166 | } |
|
175 | } | |
167 | }; |
|
176 | }; | |
168 |
|
177 | |||
169 | QTCOMMERCIALCHART_END_NAMESPACE |
|
178 | QTCOMMERCIALCHART_END_NAMESPACE | |
170 |
|
179 | |||
171 | #endif // CHARTTHEMESYSTEM_P_H |
|
180 | #endif // CHARTTHEMESYSTEM_P_H |
@@ -1,96 +1,105 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
|
21 | // W A R N I N G | |||
|
22 | // ------------- | |||
|
23 | // | |||
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |||
|
25 | // implementation detail. This header file may change from version to | |||
|
26 | // version without notice, or even be removed. | |||
|
27 | // | |||
|
28 | // We mean it. | |||
|
29 | ||||
21 | #ifndef XYCHARTITEM_H |
|
30 | #ifndef XYCHARTITEM_H | |
22 | #define XYCHARTITEM_H |
|
31 | #define XYCHARTITEM_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include "chartitem_p.h" |
|
34 | #include "chartitem_p.h" | |
26 | #include "xyanimation_p.h" |
|
35 | #include "xyanimation_p.h" | |
27 | #include <QPen> |
|
36 | #include <QPen> | |
28 |
|
37 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
39 | |||
31 | class ChartPresenter; |
|
40 | class ChartPresenter; | |
32 | class QXYSeries; |
|
41 | class QXYSeries; | |
33 |
|
42 | |||
34 | class XYChart : public Chart |
|
43 | class XYChart : public Chart | |
35 | { |
|
44 | { | |
36 | Q_OBJECT |
|
45 | Q_OBJECT | |
37 | public: |
|
46 | public: | |
38 | explicit XYChart(QXYSeries *series, ChartPresenter *presenter); |
|
47 | explicit XYChart(QXYSeries *series, ChartPresenter *presenter); | |
39 | ~XYChart(){}; |
|
48 | ~XYChart(){}; | |
40 |
|
49 | |||
41 | void setGeometryPoints(const QVector<QPointF>& points); |
|
50 | void setGeometryPoints(const QVector<QPointF>& points); | |
42 | QVector<QPointF> geometryPoints() const { return m_points; } |
|
51 | QVector<QPointF> geometryPoints() const { return m_points; } | |
43 |
|
52 | |||
44 | void setClipRect(const QRectF &rect); |
|
53 | void setClipRect(const QRectF &rect); | |
45 | QRectF clipRect() const { return m_clipRect; } |
|
54 | QRectF clipRect() const { return m_clipRect; } | |
46 |
|
55 | |||
47 | QSizeF size() const { return m_size; } |
|
56 | QSizeF size() const { return m_size; } | |
48 | QPointF origin() const { return m_origin; } |
|
57 | QPointF origin() const { return m_origin; } | |
49 |
|
58 | |||
50 | void setAnimation(XYAnimation* animation); |
|
59 | void setAnimation(XYAnimation* animation); | |
51 | ChartAnimation* animation() const { return m_animation; } |
|
60 | ChartAnimation* animation() const { return m_animation; } | |
52 | virtual void updateGeometry() = 0; |
|
61 | virtual void updateGeometry() = 0; | |
53 |
|
62 | |||
54 | bool isDirty() const { return m_dirty; } |
|
63 | bool isDirty() const { return m_dirty; } | |
55 | void setDirty(bool dirty); |
|
64 | void setDirty(bool dirty); | |
56 |
|
65 | |||
57 | public Q_SLOTS: |
|
66 | public Q_SLOTS: | |
58 | void handlePointAdded(int index); |
|
67 | void handlePointAdded(int index); | |
59 | void handlePointRemoved(int index); |
|
68 | void handlePointRemoved(int index); | |
60 | void handlePointReplaced(int index); |
|
69 | void handlePointReplaced(int index); | |
61 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
70 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
62 | void handleGeometryChanged(const QRectF &size); |
|
71 | void handleGeometryChanged(const QRectF &size); | |
63 |
|
72 | |||
64 | Q_SIGNALS: |
|
73 | Q_SIGNALS: | |
65 | void clicked(const QPointF& point); |
|
74 | void clicked(const QPointF& point); | |
66 |
|
75 | |||
67 | protected: |
|
76 | protected: | |
68 | virtual void updateChart(QVector<QPointF> &oldPoints,QVector<QPointF> &newPoints,int index = -1); |
|
77 | virtual void updateChart(QVector<QPointF> &oldPoints,QVector<QPointF> &newPoints,int index = -1); | |
69 | QPointF calculateGeometryPoint(const QPointF &point) const; |
|
78 | QPointF calculateGeometryPoint(const QPointF &point) const; | |
70 | QPointF calculateGeometryPoint(int index) const; |
|
79 | QPointF calculateGeometryPoint(int index) const; | |
71 | QPointF calculateDomainPoint(const QPointF &point) const; |
|
80 | QPointF calculateDomainPoint(const QPointF &point) const; | |
72 | QVector<QPointF> calculateGeometryPoints() const; |
|
81 | QVector<QPointF> calculateGeometryPoints() const; | |
73 |
|
82 | |||
74 | private: |
|
83 | private: | |
75 | inline bool isEmpty(); |
|
84 | inline bool isEmpty(); | |
76 |
|
85 | |||
77 | private: |
|
86 | private: | |
78 | qreal m_minX; |
|
87 | qreal m_minX; | |
79 | qreal m_maxX; |
|
88 | qreal m_maxX; | |
80 | qreal m_minY; |
|
89 | qreal m_minY; | |
81 | qreal m_maxY; |
|
90 | qreal m_maxY; | |
82 | QXYSeries* m_series; |
|
91 | QXYSeries* m_series; | |
83 | QSizeF m_size; |
|
92 | QSizeF m_size; | |
84 | QPointF m_origin; |
|
93 | QPointF m_origin; | |
85 | QRectF m_clipRect; |
|
94 | QRectF m_clipRect; | |
86 | QVector<QPointF> m_points; |
|
95 | QVector<QPointF> m_points; | |
87 | XYAnimation* m_animation; |
|
96 | XYAnimation* m_animation; | |
88 | bool m_dirty; |
|
97 | bool m_dirty; | |
89 |
|
98 | |||
90 | friend class AreaChartItem; |
|
99 | friend class AreaChartItem; | |
91 |
|
100 | |||
92 | }; |
|
101 | }; | |
93 |
|
102 | |||
94 | QTCOMMERCIALCHART_END_NAMESPACE |
|
103 | QTCOMMERCIALCHART_END_NAMESPACE | |
95 |
|
104 | |||
96 | #endif |
|
105 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now