@@ -1,166 +1,167 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2013 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | // W A R N I N G |
|
22 | 22 | // ------------- |
|
23 | 23 | // |
|
24 | 24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
25 | 25 | // implementation detail. This header file may change from version to |
|
26 | 26 | // version without notice, or even be removed. |
|
27 | 27 | // |
|
28 | 28 | // We mean it. |
|
29 | 29 | |
|
30 | 30 | #ifndef CHARTPRESENTER_H |
|
31 | 31 | #define CHARTPRESENTER_H |
|
32 | 32 | |
|
33 | 33 | #include "qchartglobal.h" |
|
34 | 34 | #include "qchart.h" //because of QChart::ChartThemeId |
|
35 | 35 | #include <QRectF> |
|
36 | 36 | #include <QMargins> |
|
37 | 37 | |
|
38 | 38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | 39 | |
|
40 | 40 | class ChartItem; |
|
41 | 41 | class AxisItem; |
|
42 | 42 | class QAbstractSeries; |
|
43 | 43 | class ChartDataSet; |
|
44 | 44 | class AbstractDomain; |
|
45 | 45 | class ChartAxis; |
|
46 | 46 | class ChartAnimator; |
|
47 | 47 | class ChartBackground; |
|
48 | 48 | class ChartTitle; |
|
49 | 49 | class ChartAnimation; |
|
50 | 50 | class ChartLayout; |
|
51 | 51 | |
|
52 | 52 | class ChartPresenter: public QObject |
|
53 | 53 | { |
|
54 | 54 | Q_OBJECT |
|
55 | 55 | public: |
|
56 | 56 | enum ZValues { |
|
57 | 57 | BackgroundZValue = -1, |
|
58 | 58 | ShadesZValue , |
|
59 | 59 | GridZValue, |
|
60 | 60 | AxisZValue, |
|
61 | 61 | SeriesZValue, |
|
62 | 62 | LineChartZValue = SeriesZValue, |
|
63 | 63 | SplineChartZValue = SeriesZValue, |
|
64 | 64 | BarSeriesZValue = SeriesZValue, |
|
65 | 65 | ScatterSeriesZValue = SeriesZValue, |
|
66 | 66 | PieSeriesZValue = SeriesZValue, |
|
67 | BoxPlotSeriesZValue = SeriesZValue, | |
|
67 | 68 | LegendZValue, |
|
68 | 69 | TopMostZValue |
|
69 | 70 | }; |
|
70 | 71 | |
|
71 | 72 | enum State { |
|
72 | 73 | ShowState, |
|
73 | 74 | ScrollUpState, |
|
74 | 75 | ScrollDownState, |
|
75 | 76 | ScrollLeftState, |
|
76 | 77 | ScrollRightState, |
|
77 | 78 | ZoomInState, |
|
78 | 79 | ZoomOutState |
|
79 | 80 | }; |
|
80 | 81 | |
|
81 | 82 | ChartPresenter(QChart *chart); |
|
82 | 83 | virtual ~ChartPresenter(); |
|
83 | 84 | |
|
84 | 85 | |
|
85 | 86 | void setGeometry(QRectF rect); |
|
86 | 87 | QRectF geometry() const; |
|
87 | 88 | |
|
88 | 89 | QGraphicsItem *rootItem(){ return m_chart; } |
|
89 | 90 | ChartBackground *backgroundElement(); |
|
90 | 91 | ChartTitle *titleElement(); |
|
91 | 92 | QList<ChartAxis *> axisItems() const; |
|
92 | 93 | QList<ChartItem *> chartItems() const; |
|
93 | 94 | |
|
94 | 95 | ChartItem* chartElement(QAbstractSeries* series) const; |
|
95 | 96 | ChartAxis* chartElement(QAbstractAxis* axis) const; |
|
96 | 97 | |
|
97 | 98 | QLegend *legend(); |
|
98 | 99 | |
|
99 | 100 | void setBackgroundBrush(const QBrush &brush); |
|
100 | 101 | QBrush backgroundBrush() const; |
|
101 | 102 | |
|
102 | 103 | void setBackgroundPen(const QPen &pen); |
|
103 | 104 | QPen backgroundPen() const; |
|
104 | 105 | |
|
105 | 106 | void setTitle(const QString &title); |
|
106 | 107 | QString title() const; |
|
107 | 108 | |
|
108 | 109 | void setTitleFont(const QFont &font); |
|
109 | 110 | QFont titleFont() const; |
|
110 | 111 | |
|
111 | 112 | void setTitleBrush(const QBrush &brush); |
|
112 | 113 | QBrush titleBrush() const; |
|
113 | 114 | |
|
114 | 115 | void setBackgroundVisible(bool visible); |
|
115 | 116 | bool isBackgroundVisible() const; |
|
116 | 117 | |
|
117 | 118 | void setBackgroundDropShadowEnabled(bool enabled); |
|
118 | 119 | bool isBackgroundDropShadowEnabled() const; |
|
119 | 120 | |
|
120 | 121 | void setVisible(bool visible); |
|
121 | 122 | |
|
122 | 123 | void setAnimationOptions(QChart::AnimationOptions options); |
|
123 | 124 | QChart::AnimationOptions animationOptions() const; |
|
124 | 125 | |
|
125 | 126 | void startAnimation(ChartAnimation *animation); |
|
126 | 127 | |
|
127 | 128 | void setState(State state,QPointF point); |
|
128 | 129 | State state() const { return m_state; } |
|
129 | 130 | QPointF statePoint() const { return m_statePoint; } |
|
130 | 131 | ChartLayout *layout(); |
|
131 | 132 | |
|
132 | 133 | private: |
|
133 | 134 | void createBackgroundItem(); |
|
134 | 135 | void createTitleItem(); |
|
135 | 136 | |
|
136 | 137 | public Q_SLOTS: |
|
137 | 138 | void handleSeriesAdded(QAbstractSeries *series); |
|
138 | 139 | void handleSeriesRemoved(QAbstractSeries *series); |
|
139 | 140 | void handleAxisAdded(QAbstractAxis *axis); |
|
140 | 141 | void handleAxisRemoved(QAbstractAxis *axis); |
|
141 | 142 | |
|
142 | 143 | private Q_SLOTS: |
|
143 | 144 | void handleAnimationFinished(); |
|
144 | 145 | |
|
145 | 146 | Q_SIGNALS: |
|
146 | 147 | void animationsFinished(); |
|
147 | 148 | |
|
148 | 149 | private: |
|
149 | 150 | QChart *m_chart; |
|
150 | 151 | QList<ChartItem *> m_chartItems; |
|
151 | 152 | QList<ChartAxis *> m_axisItems; |
|
152 | 153 | QList<QAbstractSeries *> m_series; |
|
153 | 154 | QList<QAbstractAxis *> m_axes; |
|
154 | 155 | QChart::AnimationOptions m_options; |
|
155 | 156 | State m_state; |
|
156 | 157 | QPointF m_statePoint; |
|
157 | 158 | QList<ChartAnimation *> m_animations; |
|
158 | 159 | ChartLayout *m_layout; |
|
159 | 160 | ChartBackground *m_background; |
|
160 | 161 | ChartTitle *m_title; |
|
161 | 162 | QRectF m_rect; |
|
162 | 163 | }; |
|
163 | 164 | |
|
164 | 165 | QTCOMMERCIALCHART_END_NAMESPACE |
|
165 | 166 | |
|
166 | 167 | #endif /* CHARTPRESENTER_H */ |
General Comments 0
You need to be logged in to leave comments.
Login now