@@ -1,497 +1,497 | |||||
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 | #include "chartaxis_p.h" |
|
21 | #include "chartaxis_p.h" | |
22 | #include "qabstractaxis.h" |
|
22 | #include "qabstractaxis.h" | |
23 | #include "qabstractaxis_p.h" |
|
23 | #include "qabstractaxis_p.h" | |
24 | #include "chartpresenter_p.h" |
|
24 | #include "chartpresenter_p.h" | |
25 | #include "chartlayout_p.h" |
|
25 | #include "chartlayout_p.h" | |
26 | #include "abstractdomain_p.h" |
|
26 | #include "abstractdomain_p.h" | |
27 | #include <qmath.h> |
|
27 | #include <qmath.h> | |
28 | #include <QDateTime> |
|
28 | #include <QDateTime> | |
29 | #include <QValueAxis> |
|
29 | #include <QValueAxis> | |
30 | #include <QLogValueAxis> |
|
30 | #include <QLogValueAxis> | |
31 | #include <QGraphicsLayout> |
|
31 | #include <QGraphicsLayout> | |
32 | #include <QFontMetrics> |
|
32 | #include <QFontMetrics> | |
33 |
|
33 | |||
34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
35 |
|
35 | |||
36 | ChartAxis::ChartAxis(QAbstractAxis *axis, QGraphicsItem* item , bool intervalAxis) |
|
36 | ChartAxis::ChartAxis(QAbstractAxis *axis, QGraphicsItem* item , bool intervalAxis) | |
37 | : ChartElement(item), |
|
37 | : ChartElement(item), | |
38 | m_axis(axis), |
|
38 | m_axis(axis), | |
39 | m_labelsAngle(0), |
|
39 | m_labelsAngle(0), | |
40 | m_grid(new QGraphicsItemGroup(item)), |
|
40 | m_grid(new QGraphicsItemGroup(item)), | |
41 | m_arrow(new QGraphicsItemGroup(item)), |
|
41 | m_arrow(new QGraphicsItemGroup(item)), | |
42 | m_shades(new QGraphicsItemGroup(item)), |
|
42 | m_shades(new QGraphicsItemGroup(item)), | |
43 | m_labels(new QGraphicsItemGroup(item)), |
|
43 | m_labels(new QGraphicsItemGroup(item)), | |
44 | m_title(new QGraphicsSimpleTextItem(item)), |
|
44 | m_title(new QGraphicsSimpleTextItem(item)), | |
45 | m_animation(0), |
|
45 | m_animation(0), | |
46 | m_labelPadding(5), |
|
46 | m_labelPadding(5), | |
47 | m_intervalAxis(intervalAxis) |
|
47 | m_intervalAxis(intervalAxis) | |
48 | { |
|
48 | { | |
49 | Q_ASSERT(item); |
|
49 | Q_ASSERT(item); | |
50 | //initial initialization |
|
50 | //initial initialization | |
51 | m_arrow->setHandlesChildEvents(false); |
|
51 | m_arrow->setHandlesChildEvents(false); | |
52 | m_arrow->setZValue(ChartPresenter::AxisZValue); |
|
52 | m_arrow->setZValue(ChartPresenter::AxisZValue); | |
53 | m_arrow->setVisible(m_axis->isLineVisible()); |
|
53 | m_arrow->setVisible(m_axis->isLineVisible()); | |
54 | m_labels->setZValue(ChartPresenter::AxisZValue); |
|
54 | m_labels->setZValue(ChartPresenter::AxisZValue); | |
55 | m_labels->setVisible(m_axis->labelsVisible()); |
|
55 | m_labels->setVisible(m_axis->labelsVisible()); | |
56 | m_shades->setZValue(ChartPresenter::ShadesZValue); |
|
56 | m_shades->setZValue(ChartPresenter::ShadesZValue); | |
57 | m_shades->setVisible(m_axis->shadesVisible()); |
|
57 | m_shades->setVisible(m_axis->shadesVisible()); | |
58 | m_grid->setZValue(ChartPresenter::GridZValue); |
|
58 | m_grid->setZValue(ChartPresenter::GridZValue); | |
59 | m_grid->setVisible(m_axis->isGridLineVisible()); |
|
59 | m_grid->setVisible(m_axis->isGridLineVisible()); | |
60 | m_title->setZValue(ChartPresenter::GridZValue); |
|
60 | m_title->setZValue(ChartPresenter::GridZValue); | |
61 | connectSlots(); |
|
61 | connectSlots(); | |
62 |
|
62 | |||
63 | setFlag(QGraphicsItem::ItemHasNoContents,true); |
|
63 | setFlag(QGraphicsItem::ItemHasNoContents,true); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | void ChartAxis::connectSlots() |
|
66 | void ChartAxis::connectSlots() | |
67 | { |
|
67 | { | |
68 | QObject::connect(m_axis,SIGNAL(visibleChanged(bool)),this,SLOT(handleVisibleChanged(bool))); |
|
68 | QObject::connect(m_axis,SIGNAL(visibleChanged(bool)),this,SLOT(handleVisibleChanged(bool))); | |
69 | QObject::connect(m_axis,SIGNAL(lineVisibleChanged(bool)),this,SLOT(handleArrowVisibleChanged(bool))); |
|
69 | QObject::connect(m_axis,SIGNAL(lineVisibleChanged(bool)),this,SLOT(handleArrowVisibleChanged(bool))); | |
70 |
QObject::connect(m_axis,SIGNAL(grid |
|
70 | QObject::connect(m_axis,SIGNAL(gridVisibleChanged(bool)),this,SLOT(handleGridVisibleChanged(bool))); | |
71 | QObject::connect(m_axis,SIGNAL(labelsVisibleChanged(bool)),this,SLOT(handleLabelsVisibleChanged(bool))); |
|
71 | QObject::connect(m_axis,SIGNAL(labelsVisibleChanged(bool)),this,SLOT(handleLabelsVisibleChanged(bool))); | |
72 | QObject::connect(m_axis,SIGNAL(shadesVisibleChanged(bool)),this,SLOT(handleShadesVisibleChanged(bool))); |
|
72 | QObject::connect(m_axis,SIGNAL(shadesVisibleChanged(bool)),this,SLOT(handleShadesVisibleChanged(bool))); | |
73 | QObject::connect(m_axis,SIGNAL(labelsAngleChanged(int)),this,SLOT(handleLabelsAngleChanged(int))); |
|
73 | QObject::connect(m_axis,SIGNAL(labelsAngleChanged(int)),this,SLOT(handleLabelsAngleChanged(int))); | |
74 | QObject::connect(m_axis,SIGNAL(linePenChanged(const QPen&)),this,SLOT(handleArrowPenChanged(const QPen&))); |
|
74 | QObject::connect(m_axis,SIGNAL(linePenChanged(const QPen&)),this,SLOT(handleArrowPenChanged(const QPen&))); | |
75 | QObject::connect(m_axis,SIGNAL(labelsPenChanged(const QPen&)),this,SLOT(handleLabelsPenChanged(const QPen&))); |
|
75 | QObject::connect(m_axis,SIGNAL(labelsPenChanged(const QPen&)),this,SLOT(handleLabelsPenChanged(const QPen&))); | |
76 | QObject::connect(m_axis,SIGNAL(labelsBrushChanged(const QBrush&)),this,SLOT(handleLabelsBrushChanged(const QBrush&))); |
|
76 | QObject::connect(m_axis,SIGNAL(labelsBrushChanged(const QBrush&)),this,SLOT(handleLabelsBrushChanged(const QBrush&))); | |
77 | QObject::connect(m_axis,SIGNAL(labelsFontChanged(const QFont&)),this,SLOT(handleLabelsFontChanged(const QFont&))); |
|
77 | QObject::connect(m_axis,SIGNAL(labelsFontChanged(const QFont&)),this,SLOT(handleLabelsFontChanged(const QFont&))); | |
78 | QObject::connect(m_axis,SIGNAL(gridLinePenChanged(const QPen&)),this,SLOT(handleGridPenChanged(const QPen&))); |
|
78 | QObject::connect(m_axis,SIGNAL(gridLinePenChanged(const QPen&)),this,SLOT(handleGridPenChanged(const QPen&))); | |
79 | QObject::connect(m_axis,SIGNAL(shadesPenChanged(const QPen&)),this,SLOT(handleShadesPenChanged(const QPen&))); |
|
79 | QObject::connect(m_axis,SIGNAL(shadesPenChanged(const QPen&)),this,SLOT(handleShadesPenChanged(const QPen&))); | |
80 | QObject::connect(m_axis,SIGNAL(shadesBrushChanged(const QBrush&)),this,SLOT(handleShadesBrushChanged(const QBrush&))); |
|
80 | QObject::connect(m_axis,SIGNAL(shadesBrushChanged(const QBrush&)),this,SLOT(handleShadesBrushChanged(const QBrush&))); | |
81 | QObject::connect(m_axis,SIGNAL(titleTextChanged(const QString&)),this,SLOT(handleTitleTextChanged(const QString&))); |
|
81 | QObject::connect(m_axis,SIGNAL(titleTextChanged(const QString&)),this,SLOT(handleTitleTextChanged(const QString&))); | |
82 | QObject::connect(m_axis,SIGNAL(titleFontChanged(const QFont&)),this,SLOT(handleTitleFontChanged(const QFont&))); |
|
82 | QObject::connect(m_axis,SIGNAL(titleFontChanged(const QFont&)),this,SLOT(handleTitleFontChanged(const QFont&))); | |
83 | QObject::connect(m_axis,SIGNAL(titlePenChanged(const QPen&)),this,SLOT(handleTitlePenChanged(const QPen&))); |
|
83 | QObject::connect(m_axis,SIGNAL(titlePenChanged(const QPen&)),this,SLOT(handleTitlePenChanged(const QPen&))); | |
84 | QObject::connect(m_axis,SIGNAL(titleBrushChanged(const QBrush&)),this,SLOT(handleTitleBrushChanged(const QBrush&))); |
|
84 | QObject::connect(m_axis,SIGNAL(titleBrushChanged(const QBrush&)),this,SLOT(handleTitleBrushChanged(const QBrush&))); | |
85 | QObject::connect(m_axis->d_ptr.data(),SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(handleRangeChanged(qreal,qreal))); |
|
85 | QObject::connect(m_axis->d_ptr.data(),SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(handleRangeChanged(qreal,qreal))); | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | ChartAxis::~ChartAxis() |
|
88 | ChartAxis::~ChartAxis() | |
89 | { |
|
89 | { | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | void ChartAxis::setAnimation(AxisAnimation *animation) |
|
92 | void ChartAxis::setAnimation(AxisAnimation *animation) | |
93 | { |
|
93 | { | |
94 | m_animation = animation; |
|
94 | m_animation = animation; | |
95 | } |
|
95 | } | |
96 |
|
96 | |||
97 | void ChartAxis::setLayout(QVector<qreal> &layout) |
|
97 | void ChartAxis::setLayout(QVector<qreal> &layout) | |
98 | { |
|
98 | { | |
99 | m_layoutVector = layout; |
|
99 | m_layoutVector = layout; | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 | void ChartAxis::createItems(int count) |
|
102 | void ChartAxis::createItems(int count) | |
103 | { |
|
103 | { | |
104 | if (m_arrow->childItems().size() == 0){ |
|
104 | if (m_arrow->childItems().size() == 0){ | |
105 | QGraphicsLineItem* arrow = new ArrowItem(this, this); |
|
105 | QGraphicsLineItem* arrow = new ArrowItem(this, this); | |
106 | arrow->setPen(m_axis->linePen()); |
|
106 | arrow->setPen(m_axis->linePen()); | |
107 | m_arrow->addToGroup(arrow); |
|
107 | m_arrow->addToGroup(arrow); | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 | if (m_intervalAxis && m_grid->childItems().size() == 0) { |
|
110 | if (m_intervalAxis && m_grid->childItems().size() == 0) { | |
111 | for (int i = 0 ; i < 2 ; i ++){ |
|
111 | for (int i = 0 ; i < 2 ; i ++){ | |
112 | QGraphicsLineItem* item = new QGraphicsLineItem(this); |
|
112 | QGraphicsLineItem* item = new QGraphicsLineItem(this); | |
113 | item->setPen(m_axis->gridLinePen()); |
|
113 | item->setPen(m_axis->gridLinePen()); | |
114 | m_grid->addToGroup(item); |
|
114 | m_grid->addToGroup(item); | |
115 | } |
|
115 | } | |
116 | } |
|
116 | } | |
117 |
|
117 | |||
118 | for (int i = 0; i < count; ++i) { |
|
118 | for (int i = 0; i < count; ++i) { | |
119 | QGraphicsLineItem* arrow = new QGraphicsLineItem(this); |
|
119 | QGraphicsLineItem* arrow = new QGraphicsLineItem(this); | |
120 | arrow->setPen(m_axis->linePen()); |
|
120 | arrow->setPen(m_axis->linePen()); | |
121 | QGraphicsLineItem* grid = new QGraphicsLineItem(this); |
|
121 | QGraphicsLineItem* grid = new QGraphicsLineItem(this); | |
122 | grid->setPen(m_axis->gridLinePen()); |
|
122 | grid->setPen(m_axis->gridLinePen()); | |
123 | QGraphicsSimpleTextItem* label = new QGraphicsSimpleTextItem(this); |
|
123 | QGraphicsSimpleTextItem* label = new QGraphicsSimpleTextItem(this); | |
124 | label->setFont(m_axis->labelsFont()); |
|
124 | label->setFont(m_axis->labelsFont()); | |
125 | label->setPen(m_axis->labelsPen()); |
|
125 | label->setPen(m_axis->labelsPen()); | |
126 | label->setBrush(m_axis->labelsBrush()); |
|
126 | label->setBrush(m_axis->labelsBrush()); | |
127 | m_arrow->addToGroup(arrow); |
|
127 | m_arrow->addToGroup(arrow); | |
128 | m_grid->addToGroup(grid); |
|
128 | m_grid->addToGroup(grid); | |
129 | m_labels->addToGroup(label); |
|
129 | m_labels->addToGroup(label); | |
130 |
|
130 | |||
131 | if ((m_grid->childItems().size()) % 2 && m_grid->childItems().size() > 2){ |
|
131 | if ((m_grid->childItems().size()) % 2 && m_grid->childItems().size() > 2){ | |
132 | QGraphicsRectItem* shades = new QGraphicsRectItem(this); |
|
132 | QGraphicsRectItem* shades = new QGraphicsRectItem(this); | |
133 | shades->setPen(m_axis->shadesPen()); |
|
133 | shades->setPen(m_axis->shadesPen()); | |
134 | shades->setBrush(m_axis->shadesBrush()); |
|
134 | shades->setBrush(m_axis->shadesBrush()); | |
135 | m_shades->addToGroup(shades); |
|
135 | m_shades->addToGroup(shades); | |
136 | } |
|
136 | } | |
137 | } |
|
137 | } | |
138 |
|
138 | |||
139 | } |
|
139 | } | |
140 |
|
140 | |||
141 | void ChartAxis::deleteItems(int count) |
|
141 | void ChartAxis::deleteItems(int count) | |
142 | { |
|
142 | { | |
143 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
143 | QList<QGraphicsItem *> lines = m_grid->childItems(); | |
144 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
144 | QList<QGraphicsItem *> labels = m_labels->childItems(); | |
145 | QList<QGraphicsItem *> shades = m_shades->childItems(); |
|
145 | QList<QGraphicsItem *> shades = m_shades->childItems(); | |
146 | QList<QGraphicsItem *> axis = m_arrow->childItems(); |
|
146 | QList<QGraphicsItem *> axis = m_arrow->childItems(); | |
147 |
|
147 | |||
148 | for (int i = 0; i < count; ++i) { |
|
148 | for (int i = 0; i < count; ++i) { | |
149 | if (lines.size() % 2 && lines.size() > 1) |
|
149 | if (lines.size() % 2 && lines.size() > 1) | |
150 | delete(shades.takeLast()); |
|
150 | delete(shades.takeLast()); | |
151 | delete(lines.takeLast()); |
|
151 | delete(lines.takeLast()); | |
152 | delete(labels.takeLast()); |
|
152 | delete(labels.takeLast()); | |
153 | delete(axis.takeLast()); |
|
153 | delete(axis.takeLast()); | |
154 | } |
|
154 | } | |
155 | } |
|
155 | } | |
156 |
|
156 | |||
157 | void ChartAxis::updateLayout(QVector<qreal> &layout) |
|
157 | void ChartAxis::updateLayout(QVector<qreal> &layout) | |
158 | { |
|
158 | { | |
159 | int diff = m_layoutVector.size() - layout.size(); |
|
159 | int diff = m_layoutVector.size() - layout.size(); | |
160 |
|
160 | |||
161 | if (diff > 0) |
|
161 | if (diff > 0) | |
162 | deleteItems(diff); |
|
162 | deleteItems(diff); | |
163 | else if (diff < 0) |
|
163 | else if (diff < 0) | |
164 | createItems(-diff); |
|
164 | createItems(-diff); | |
165 |
|
165 | |||
166 | if (m_animation) { |
|
166 | if (m_animation) { | |
167 | switch (presenter()->state()) { |
|
167 | switch (presenter()->state()) { | |
168 | case ChartPresenter::ZoomInState: |
|
168 | case ChartPresenter::ZoomInState: | |
169 | m_animation->setAnimationType(AxisAnimation::ZoomInAnimation); |
|
169 | m_animation->setAnimationType(AxisAnimation::ZoomInAnimation); | |
170 | m_animation->setAnimationPoint(presenter()->statePoint()); |
|
170 | m_animation->setAnimationPoint(presenter()->statePoint()); | |
171 | break; |
|
171 | break; | |
172 | case ChartPresenter::ZoomOutState: |
|
172 | case ChartPresenter::ZoomOutState: | |
173 | m_animation->setAnimationType(AxisAnimation::ZoomOutAnimation); |
|
173 | m_animation->setAnimationType(AxisAnimation::ZoomOutAnimation); | |
174 | m_animation->setAnimationPoint(presenter()->statePoint()); |
|
174 | m_animation->setAnimationPoint(presenter()->statePoint()); | |
175 | break; |
|
175 | break; | |
176 | case ChartPresenter::ScrollUpState: |
|
176 | case ChartPresenter::ScrollUpState: | |
177 | case ChartPresenter::ScrollLeftState: |
|
177 | case ChartPresenter::ScrollLeftState: | |
178 | m_animation->setAnimationType(AxisAnimation::MoveBackwordAnimation); |
|
178 | m_animation->setAnimationType(AxisAnimation::MoveBackwordAnimation); | |
179 | break; |
|
179 | break; | |
180 | case ChartPresenter::ScrollDownState: |
|
180 | case ChartPresenter::ScrollDownState: | |
181 | case ChartPresenter::ScrollRightState: |
|
181 | case ChartPresenter::ScrollRightState: | |
182 | m_animation->setAnimationType(AxisAnimation::MoveForwardAnimation); |
|
182 | m_animation->setAnimationType(AxisAnimation::MoveForwardAnimation); | |
183 | break; |
|
183 | break; | |
184 | case ChartPresenter::ShowState: |
|
184 | case ChartPresenter::ShowState: | |
185 | m_animation->setAnimationType(AxisAnimation::DefaultAnimation); |
|
185 | m_animation->setAnimationType(AxisAnimation::DefaultAnimation); | |
186 | break; |
|
186 | break; | |
187 | } |
|
187 | } | |
188 | m_animation->setValues(m_layoutVector, layout); |
|
188 | m_animation->setValues(m_layoutVector, layout); | |
189 | presenter()->startAnimation(m_animation); |
|
189 | presenter()->startAnimation(m_animation); | |
190 | } else { |
|
190 | } else { | |
191 | setLayout(layout); |
|
191 | setLayout(layout); | |
192 | updateGeometry(); |
|
192 | updateGeometry(); | |
193 | } |
|
193 | } | |
194 | } |
|
194 | } | |
195 |
|
195 | |||
196 | void ChartAxis::setLabelPadding(int padding) |
|
196 | void ChartAxis::setLabelPadding(int padding) | |
197 | { |
|
197 | { | |
198 | m_labelPadding = padding; |
|
198 | m_labelPadding = padding; | |
199 | } |
|
199 | } | |
200 |
|
200 | |||
201 | bool ChartAxis::isEmpty() |
|
201 | bool ChartAxis::isEmpty() | |
202 | { |
|
202 | { | |
203 | return m_axisRect.isEmpty() || m_gridRect.isEmpty() || qFuzzyCompare(min(),max()); |
|
203 | return m_axisRect.isEmpty() || m_gridRect.isEmpty() || qFuzzyCompare(min(),max()); | |
204 | } |
|
204 | } | |
205 |
|
205 | |||
206 | void ChartAxis::setGeometry(const QRectF &axis, const QRectF &grid) |
|
206 | void ChartAxis::setGeometry(const QRectF &axis, const QRectF &grid) | |
207 | { |
|
207 | { | |
208 | m_gridRect = grid; |
|
208 | m_gridRect = grid; | |
209 | m_axisRect = axis; |
|
209 | m_axisRect = axis; | |
210 |
|
210 | |||
211 | if (isEmpty()) |
|
211 | if (isEmpty()) | |
212 | return; |
|
212 | return; | |
213 |
|
213 | |||
214 | QVector<qreal> layout = calculateLayout(); |
|
214 | QVector<qreal> layout = calculateLayout(); | |
215 | updateLayout(layout); |
|
215 | updateLayout(layout); | |
216 | } |
|
216 | } | |
217 |
|
217 | |||
218 | qreal ChartAxis::min() const |
|
218 | qreal ChartAxis::min() const | |
219 | { |
|
219 | { | |
220 | return m_axis->d_ptr->min(); |
|
220 | return m_axis->d_ptr->min(); | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
223 | qreal ChartAxis::max() const |
|
223 | qreal ChartAxis::max() const | |
224 | { |
|
224 | { | |
225 | return m_axis->d_ptr->max(); |
|
225 | return m_axis->d_ptr->max(); | |
226 | } |
|
226 | } | |
227 |
|
227 | |||
228 | QFont ChartAxis::font() const |
|
228 | QFont ChartAxis::font() const | |
229 | { |
|
229 | { | |
230 | return m_axis->labelsFont(); |
|
230 | return m_axis->labelsFont(); | |
231 | } |
|
231 | } | |
232 |
|
232 | |||
233 | QFont ChartAxis::titleFont() const |
|
233 | QFont ChartAxis::titleFont() const | |
234 | { |
|
234 | { | |
235 | return m_axis->titleFont(); |
|
235 | return m_axis->titleFont(); | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | QString ChartAxis::titleText() const |
|
238 | QString ChartAxis::titleText() const | |
239 | { |
|
239 | { | |
240 | return m_axis->titleText(); |
|
240 | return m_axis->titleText(); | |
241 | } |
|
241 | } | |
242 |
|
242 | |||
243 | void ChartAxis::axisSelected() |
|
243 | void ChartAxis::axisSelected() | |
244 | { |
|
244 | { | |
245 | emit clicked(); |
|
245 | emit clicked(); | |
246 | } |
|
246 | } | |
247 |
|
247 | |||
248 | Qt::Orientation ChartAxis::orientation() const |
|
248 | Qt::Orientation ChartAxis::orientation() const | |
249 | { |
|
249 | { | |
250 | return m_axis->orientation(); |
|
250 | return m_axis->orientation(); | |
251 | } |
|
251 | } | |
252 |
|
252 | |||
253 | Qt::Alignment ChartAxis::alignment() const |
|
253 | Qt::Alignment ChartAxis::alignment() const | |
254 | { |
|
254 | { | |
255 | return m_axis->alignment(); |
|
255 | return m_axis->alignment(); | |
256 | } |
|
256 | } | |
257 |
|
257 | |||
258 | void ChartAxis::setLabels(const QStringList &labels) |
|
258 | void ChartAxis::setLabels(const QStringList &labels) | |
259 | { |
|
259 | { | |
260 | m_labelsList = labels; |
|
260 | m_labelsList = labels; | |
261 | } |
|
261 | } | |
262 |
|
262 | |||
263 | QSizeF ChartAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const |
|
263 | QSizeF ChartAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const | |
264 | { |
|
264 | { | |
265 | Q_UNUSED(which); |
|
265 | Q_UNUSED(which); | |
266 | Q_UNUSED(constraint); |
|
266 | Q_UNUSED(constraint); | |
267 | return QSizeF(); |
|
267 | return QSizeF(); | |
268 | } |
|
268 | } | |
269 |
|
269 | |||
270 | //handlers |
|
270 | //handlers | |
271 |
|
271 | |||
272 | void ChartAxis::handleArrowVisibleChanged(bool visible) |
|
272 | void ChartAxis::handleArrowVisibleChanged(bool visible) | |
273 | { |
|
273 | { | |
274 | m_arrow->setVisible(visible); |
|
274 | m_arrow->setVisible(visible); | |
275 | } |
|
275 | } | |
276 |
|
276 | |||
277 | void ChartAxis::handleGridVisibleChanged(bool visible) |
|
277 | void ChartAxis::handleGridVisibleChanged(bool visible) | |
278 | { |
|
278 | { | |
279 | m_grid->setVisible(visible); |
|
279 | m_grid->setVisible(visible); | |
280 | } |
|
280 | } | |
281 |
|
281 | |||
282 | void ChartAxis::handleLabelsVisibleChanged(bool visible) |
|
282 | void ChartAxis::handleLabelsVisibleChanged(bool visible) | |
283 | { |
|
283 | { | |
284 | m_labels->setVisible(visible); |
|
284 | m_labels->setVisible(visible); | |
285 | } |
|
285 | } | |
286 |
|
286 | |||
287 | void ChartAxis::handleShadesVisibleChanged(bool visible) |
|
287 | void ChartAxis::handleShadesVisibleChanged(bool visible) | |
288 | { |
|
288 | { | |
289 | m_shades->setVisible(visible); |
|
289 | m_shades->setVisible(visible); | |
290 | } |
|
290 | } | |
291 |
|
291 | |||
292 | void ChartAxis::handleLabelsAngleChanged(int angle) |
|
292 | void ChartAxis::handleLabelsAngleChanged(int angle) | |
293 | { |
|
293 | { | |
294 | foreach (QGraphicsItem *item, m_labels->childItems()) |
|
294 | foreach (QGraphicsItem *item, m_labels->childItems()) | |
295 | item->setRotation(angle); |
|
295 | item->setRotation(angle); | |
296 |
|
296 | |||
297 | m_labelsAngle = angle; |
|
297 | m_labelsAngle = angle; | |
298 | } |
|
298 | } | |
299 |
|
299 | |||
300 | void ChartAxis::handleLabelsPenChanged(const QPen &pen) |
|
300 | void ChartAxis::handleLabelsPenChanged(const QPen &pen) | |
301 | { |
|
301 | { | |
302 | foreach (QGraphicsItem *item , m_labels->childItems()) |
|
302 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
303 | static_cast<QGraphicsSimpleTextItem *>(item)->setPen(pen); |
|
303 | static_cast<QGraphicsSimpleTextItem *>(item)->setPen(pen); | |
304 | } |
|
304 | } | |
305 |
|
305 | |||
306 | void ChartAxis::handleLabelsBrushChanged(const QBrush &brush) |
|
306 | void ChartAxis::handleLabelsBrushChanged(const QBrush &brush) | |
307 | { |
|
307 | { | |
308 | foreach (QGraphicsItem *item , m_labels->childItems()) |
|
308 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
309 | static_cast<QGraphicsSimpleTextItem *>(item)->setBrush(brush); |
|
309 | static_cast<QGraphicsSimpleTextItem *>(item)->setBrush(brush); | |
310 | } |
|
310 | } | |
311 |
|
311 | |||
312 | void ChartAxis::handleLabelsFontChanged(const QFont &font) |
|
312 | void ChartAxis::handleLabelsFontChanged(const QFont &font) | |
313 | { |
|
313 | { | |
314 | foreach (QGraphicsItem *item , m_labels->childItems()) |
|
314 | foreach (QGraphicsItem *item , m_labels->childItems()) | |
315 | static_cast<QGraphicsSimpleTextItem *>(item)->setFont(font); |
|
315 | static_cast<QGraphicsSimpleTextItem *>(item)->setFont(font); | |
316 | QGraphicsLayoutItem::updateGeometry(); |
|
316 | QGraphicsLayoutItem::updateGeometry(); | |
317 | presenter()->layout()->invalidate(); |
|
317 | presenter()->layout()->invalidate(); | |
318 | } |
|
318 | } | |
319 |
|
319 | |||
320 | void ChartAxis::handleShadesBrushChanged(const QBrush &brush) |
|
320 | void ChartAxis::handleShadesBrushChanged(const QBrush &brush) | |
321 | { |
|
321 | { | |
322 | foreach (QGraphicsItem *item , m_shades->childItems()) |
|
322 | foreach (QGraphicsItem *item , m_shades->childItems()) | |
323 | static_cast<QGraphicsRectItem *>(item)->setBrush(brush); |
|
323 | static_cast<QGraphicsRectItem *>(item)->setBrush(brush); | |
324 | } |
|
324 | } | |
325 |
|
325 | |||
326 | void ChartAxis::handleShadesPenChanged(const QPen &pen) |
|
326 | void ChartAxis::handleShadesPenChanged(const QPen &pen) | |
327 | { |
|
327 | { | |
328 | foreach (QGraphicsItem *item , m_shades->childItems()) |
|
328 | foreach (QGraphicsItem *item , m_shades->childItems()) | |
329 | static_cast<QGraphicsRectItem *>(item)->setPen(pen); |
|
329 | static_cast<QGraphicsRectItem *>(item)->setPen(pen); | |
330 | } |
|
330 | } | |
331 |
|
331 | |||
332 | void ChartAxis::handleArrowPenChanged(const QPen &pen) |
|
332 | void ChartAxis::handleArrowPenChanged(const QPen &pen) | |
333 | { |
|
333 | { | |
334 | foreach (QGraphicsItem *item , m_arrow->childItems()) |
|
334 | foreach (QGraphicsItem *item , m_arrow->childItems()) | |
335 | static_cast<QGraphicsLineItem *>(item)->setPen(pen); |
|
335 | static_cast<QGraphicsLineItem *>(item)->setPen(pen); | |
336 | } |
|
336 | } | |
337 |
|
337 | |||
338 | void ChartAxis::handleGridPenChanged(const QPen &pen) |
|
338 | void ChartAxis::handleGridPenChanged(const QPen &pen) | |
339 | { |
|
339 | { | |
340 | foreach (QGraphicsItem *item , m_grid->childItems()) |
|
340 | foreach (QGraphicsItem *item , m_grid->childItems()) | |
341 | static_cast<QGraphicsLineItem *>(item)->setPen(pen); |
|
341 | static_cast<QGraphicsLineItem *>(item)->setPen(pen); | |
342 | } |
|
342 | } | |
343 |
|
343 | |||
344 | void ChartAxis::handleTitleTextChanged(const QString &title) |
|
344 | void ChartAxis::handleTitleTextChanged(const QString &title) | |
345 | { |
|
345 | { | |
346 | Q_UNUSED(title) |
|
346 | Q_UNUSED(title) | |
347 | QGraphicsLayoutItem::updateGeometry(); |
|
347 | QGraphicsLayoutItem::updateGeometry(); | |
348 | presenter()->layout()->invalidate(); |
|
348 | presenter()->layout()->invalidate(); | |
349 | } |
|
349 | } | |
350 |
|
350 | |||
351 |
|
351 | |||
352 | void ChartAxis::handleTitlePenChanged(const QPen &pen) |
|
352 | void ChartAxis::handleTitlePenChanged(const QPen &pen) | |
353 | { |
|
353 | { | |
354 | m_title->setPen(pen); |
|
354 | m_title->setPen(pen); | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | void ChartAxis::handleTitleBrushChanged(const QBrush &brush) |
|
357 | void ChartAxis::handleTitleBrushChanged(const QBrush &brush) | |
358 | { |
|
358 | { | |
359 | m_title->setBrush(brush); |
|
359 | m_title->setBrush(brush); | |
360 | } |
|
360 | } | |
361 |
|
361 | |||
362 | void ChartAxis::handleTitleFontChanged(const QFont &font) |
|
362 | void ChartAxis::handleTitleFontChanged(const QFont &font) | |
363 | { |
|
363 | { | |
364 | if(m_title->font() != font){ |
|
364 | if(m_title->font() != font){ | |
365 | m_title->setFont(font); |
|
365 | m_title->setFont(font); | |
366 | QGraphicsLayoutItem::updateGeometry(); |
|
366 | QGraphicsLayoutItem::updateGeometry(); | |
367 | presenter()->layout()->invalidate(); |
|
367 | presenter()->layout()->invalidate(); | |
368 | } |
|
368 | } | |
369 | } |
|
369 | } | |
370 |
|
370 | |||
371 | void ChartAxis::handleVisibleChanged(bool visible) |
|
371 | void ChartAxis::handleVisibleChanged(bool visible) | |
372 | { |
|
372 | { | |
373 | setVisible(visible); |
|
373 | setVisible(visible); | |
374 | } |
|
374 | } | |
375 |
|
375 | |||
376 | void ChartAxis::handleRangeChanged(qreal min, qreal max) |
|
376 | void ChartAxis::handleRangeChanged(qreal min, qreal max) | |
377 | { |
|
377 | { | |
378 | Q_UNUSED(min); |
|
378 | Q_UNUSED(min); | |
379 | Q_UNUSED(max); |
|
379 | Q_UNUSED(max); | |
380 |
|
380 | |||
381 | if (!isEmpty()) { |
|
381 | if (!isEmpty()) { | |
382 |
|
382 | |||
383 | QVector<qreal> layout = calculateLayout(); |
|
383 | QVector<qreal> layout = calculateLayout(); | |
384 | updateLayout(layout); |
|
384 | updateLayout(layout); | |
385 | QSizeF before = effectiveSizeHint(Qt::PreferredSize); |
|
385 | QSizeF before = effectiveSizeHint(Qt::PreferredSize); | |
386 | QSizeF after = sizeHint(Qt::PreferredSize); |
|
386 | QSizeF after = sizeHint(Qt::PreferredSize); | |
387 |
|
387 | |||
388 | if (before != after) { |
|
388 | if (before != after) { | |
389 | QGraphicsLayoutItem::updateGeometry(); |
|
389 | QGraphicsLayoutItem::updateGeometry(); | |
390 | //we don't want to call invalidate on layout, since it will change minimum size of component, |
|
390 | //we don't want to call invalidate on layout, since it will change minimum size of component, | |
391 | //which we would like to avoid since it causes nasty flips when scrolling or zooming, |
|
391 | //which we would like to avoid since it causes nasty flips when scrolling or zooming, | |
392 | //instead recalculate layout and use plotArea for extra space. |
|
392 | //instead recalculate layout and use plotArea for extra space. | |
393 | presenter()->layout()->setGeometry(presenter()->layout()->geometry()); |
|
393 | presenter()->layout()->setGeometry(presenter()->layout()->geometry()); | |
394 | } |
|
394 | } | |
395 | } |
|
395 | } | |
396 |
|
396 | |||
397 | } |
|
397 | } | |
398 |
|
398 | |||
399 | //helpers |
|
399 | //helpers | |
400 |
|
400 | |||
401 | QStringList ChartAxis::createValueLabels(qreal min, qreal max, int ticks,const QString& format) |
|
401 | QStringList ChartAxis::createValueLabels(qreal min, qreal max, int ticks,const QString& format) | |
402 | { |
|
402 | { | |
403 | //TODO: Q_ASSERT(m_max > m_min); |
|
403 | //TODO: Q_ASSERT(m_max > m_min); | |
404 | //TODO: Q_ASSERT(ticks > 1); |
|
404 | //TODO: Q_ASSERT(ticks > 1); | |
405 |
|
405 | |||
406 | QStringList labels; |
|
406 | QStringList labels; | |
407 |
|
407 | |||
408 | if(max <= min || ticks < 1){ |
|
408 | if(max <= min || ticks < 1){ | |
409 | return labels; |
|
409 | return labels; | |
410 | } |
|
410 | } | |
411 |
|
411 | |||
412 | int n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0); |
|
412 | int n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0); | |
413 | n++; |
|
413 | n++; | |
414 |
|
414 | |||
415 | if (format.isNull()) { |
|
415 | if (format.isNull()) { | |
416 | for (int i = 0; i < ticks; i++) { |
|
416 | for (int i = 0; i < ticks; i++) { | |
417 | qreal value = min + (i * (max - min) / (ticks - 1)); |
|
417 | qreal value = min + (i * (max - min) / (ticks - 1)); | |
418 | labels << QString::number(value, 'f', n); |
|
418 | labels << QString::number(value, 'f', n); | |
419 | } |
|
419 | } | |
420 | } else { |
|
420 | } else { | |
421 | QByteArray array = format.toLatin1(); |
|
421 | QByteArray array = format.toLatin1(); | |
422 | for (int i = 0; i < ticks; i++) { |
|
422 | for (int i = 0; i < ticks; i++) { | |
423 | qreal value = min + (i * (max - min) / (ticks - 1)); |
|
423 | qreal value = min + (i * (max - min) / (ticks - 1)); | |
424 | if (format.contains("d") |
|
424 | if (format.contains("d") | |
425 | || format.contains("i") |
|
425 | || format.contains("i") | |
426 | || format.contains("c")) |
|
426 | || format.contains("c")) | |
427 | labels << QString().sprintf(array, (qint64)value); |
|
427 | labels << QString().sprintf(array, (qint64)value); | |
428 | else if (format.contains("u") |
|
428 | else if (format.contains("u") | |
429 | || format.contains("o") |
|
429 | || format.contains("o") | |
430 | || format.contains("x", Qt::CaseInsensitive)) |
|
430 | || format.contains("x", Qt::CaseInsensitive)) | |
431 | labels << QString().sprintf(array, (quint64)value); |
|
431 | labels << QString().sprintf(array, (quint64)value); | |
432 | else if (format.contains("f", Qt::CaseInsensitive) |
|
432 | else if (format.contains("f", Qt::CaseInsensitive) | |
433 | || format.contains("e", Qt::CaseInsensitive) |
|
433 | || format.contains("e", Qt::CaseInsensitive) | |
434 | || format.contains("g", Qt::CaseInsensitive)) |
|
434 | || format.contains("g", Qt::CaseInsensitive)) | |
435 | labels << QString().sprintf(array, value); |
|
435 | labels << QString().sprintf(array, value); | |
436 | } |
|
436 | } | |
437 | } |
|
437 | } | |
438 |
|
438 | |||
439 | return labels; |
|
439 | return labels; | |
440 | } |
|
440 | } | |
441 |
|
441 | |||
442 | QStringList ChartAxis::createLogValueLabels(qreal min, qreal max, qreal base, int ticks, const QString& format) |
|
442 | QStringList ChartAxis::createLogValueLabels(qreal min, qreal max, qreal base, int ticks, const QString& format) | |
443 | { |
|
443 | { | |
444 | // Q_ASSERT(m_max > m_min); |
|
444 | // Q_ASSERT(m_max > m_min); | |
445 | // Q_ASSERT(ticks > 1); |
|
445 | // Q_ASSERT(ticks > 1); | |
446 |
|
446 | |||
447 | QStringList labels; |
|
447 | QStringList labels; | |
448 |
|
448 | |||
449 | int n = 0; |
|
449 | int n = 0; | |
450 | if (ticks > 1) |
|
450 | if (ticks > 1) | |
451 | n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0); |
|
451 | n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0); | |
452 | n++; |
|
452 | n++; | |
453 |
|
453 | |||
454 | int firstTick; |
|
454 | int firstTick; | |
455 | if (base > 1) |
|
455 | if (base > 1) | |
456 | firstTick = ceil(log10(min) / log10(base)); |
|
456 | firstTick = ceil(log10(min) / log10(base)); | |
457 | else |
|
457 | else | |
458 | firstTick = ceil(log10(max) / log10(base)); |
|
458 | firstTick = ceil(log10(max) / log10(base)); | |
459 |
|
459 | |||
460 | if (format.isNull()) { |
|
460 | if (format.isNull()) { | |
461 | for (int i = firstTick; i < ticks + firstTick; i++) { |
|
461 | for (int i = firstTick; i < ticks + firstTick; i++) { | |
462 | qreal value = qPow(base, i); |
|
462 | qreal value = qPow(base, i); | |
463 | labels << QString::number(value, 'f', n); |
|
463 | labels << QString::number(value, 'f', n); | |
464 | } |
|
464 | } | |
465 | } else { |
|
465 | } else { | |
466 | QByteArray array = format.toLatin1(); |
|
466 | QByteArray array = format.toLatin1(); | |
467 | for (int i = firstTick; i < ticks + firstTick; i++) { |
|
467 | for (int i = firstTick; i < ticks + firstTick; i++) { | |
468 | qreal value = qPow(base, i); |
|
468 | qreal value = qPow(base, i); | |
469 | labels << QString().sprintf(array, value); |
|
469 | labels << QString().sprintf(array, value); | |
470 | } |
|
470 | } | |
471 | } |
|
471 | } | |
472 |
|
472 | |||
473 | return labels; |
|
473 | return labels; | |
474 | } |
|
474 | } | |
475 |
|
475 | |||
476 | QStringList ChartAxis::createDateTimeLabels(qreal min, qreal max,int ticks,const QString& format) |
|
476 | QStringList ChartAxis::createDateTimeLabels(qreal min, qreal max,int ticks,const QString& format) | |
477 | { |
|
477 | { | |
478 | //TODO: Q_ASSERT(m_max > m_min); |
|
478 | //TODO: Q_ASSERT(m_max > m_min); | |
479 | //TODO: Q_ASSERT(ticks > 1); |
|
479 | //TODO: Q_ASSERT(ticks > 1); | |
480 | QStringList labels; |
|
480 | QStringList labels; | |
481 |
|
481 | |||
482 | if(max <= min || ticks < 1) { |
|
482 | if(max <= min || ticks < 1) { | |
483 | return labels; |
|
483 | return labels; | |
484 | } |
|
484 | } | |
485 |
|
485 | |||
486 | int n = qMax(int(-floor(log10((max - min) / (ticks - 1)))), 0); |
|
486 | int n = qMax(int(-floor(log10((max - min) / (ticks - 1)))), 0); | |
487 | n++; |
|
487 | n++; | |
488 | for (int i = 0; i < ticks; i++) { |
|
488 | for (int i = 0; i < ticks; i++) { | |
489 | qreal value = min + (i * (max - min) / (ticks - 1)); |
|
489 | qreal value = min + (i * (max - min) / (ticks - 1)); | |
490 | labels << QDateTime::fromMSecsSinceEpoch(value).toString(format); |
|
490 | labels << QDateTime::fromMSecsSinceEpoch(value).toString(format); | |
491 | } |
|
491 | } | |
492 | return labels; |
|
492 | return labels; | |
493 | } |
|
493 | } | |
494 |
|
494 | |||
495 | #include "moc_chartaxis_p.cpp" |
|
495 | #include "moc_chartaxis_p.cpp" | |
496 |
|
496 | |||
497 | QTCOMMERCIALCHART_END_NAMESPACE |
|
497 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,868 +1,868 | |||||
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 | #include "qabstractaxis.h" |
|
21 | #include "qabstractaxis.h" | |
22 | #include "qabstractaxis_p.h" |
|
22 | #include "qabstractaxis_p.h" | |
23 | #include "chartdataset_p.h" |
|
23 | #include "chartdataset_p.h" | |
24 | #include "charttheme_p.h" |
|
24 | #include "charttheme_p.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | /*! |
|
28 | /*! | |
29 | \class QAbstractAxis |
|
29 | \class QAbstractAxis | |
30 | \brief The QAbstractAxis class is used for manipulating chart's axis. |
|
30 | \brief The QAbstractAxis class is used for manipulating chart's axis. | |
31 | \mainclass |
|
31 | \mainclass | |
32 |
|
32 | |||
33 | There is only one x Axis visible at the time, however there can be multiple y axes. |
|
33 | There is only one x Axis visible at the time, however there can be multiple y axes. | |
34 | Each chart series can be bound to exactly one Y axis and the shared common X axis. |
|
34 | Each chart series can be bound to exactly one Y axis and the shared common X axis. | |
35 | Axis can be setup to show axis line with tick marks, grid lines and shades. |
|
35 | Axis can be setup to show axis line with tick marks, grid lines and shades. | |
36 | */ |
|
36 | */ | |
37 |
|
37 | |||
38 | /*! |
|
38 | /*! | |
39 | \qmlclass AbstractAxis QAbstractAxis |
|
39 | \qmlclass AbstractAxis QAbstractAxis | |
40 | \brief The Axis element is used for manipulating chart's axes |
|
40 | \brief The Axis element is used for manipulating chart's axes | |
41 |
|
41 | |||
42 | There is only one x Axis visible at the time, however there can be multiple y axes on a ChartView. |
|
42 | There is only one x Axis visible at the time, however there can be multiple y axes on a ChartView. | |
43 | Each chart series can be bound to exactly one Y axis and the shared common X axis. |
|
43 | Each chart series can be bound to exactly one Y axis and the shared common X axis. | |
44 | Axis can be setup to show axis line with tick marks, grid lines and shades. |
|
44 | Axis can be setup to show axis line with tick marks, grid lines and shades. | |
45 |
|
45 | |||
46 | To access Axes you can use ChartView API. For example: |
|
46 | To access Axes you can use ChartView API. For example: | |
47 | \code |
|
47 | \code | |
48 | ChartView { |
|
48 | ChartView { | |
49 | axisX.min: 0 |
|
49 | axisX.min: 0 | |
50 | axisX.max: 3 |
|
50 | axisX.max: 3 | |
51 | axisX.ticksCount: 4 |
|
51 | axisX.ticksCount: 4 | |
52 | axisY.min: 0 |
|
52 | axisY.min: 0 | |
53 | axisY.max: 4 |
|
53 | axisY.max: 4 | |
54 | // Add a few series... |
|
54 | // Add a few series... | |
55 | } |
|
55 | } | |
56 | \endcode |
|
56 | \endcode | |
57 | */ |
|
57 | */ | |
58 |
|
58 | |||
59 | /*! |
|
59 | /*! | |
60 | \enum QAbstractAxis::AxisType |
|
60 | \enum QAbstractAxis::AxisType | |
61 |
|
61 | |||
62 | The type of the series object. |
|
62 | The type of the series object. | |
63 |
|
63 | |||
64 | \value AxisTypeNoAxis |
|
64 | \value AxisTypeNoAxis | |
65 | \value AxisTypeValue |
|
65 | \value AxisTypeValue | |
66 | \value AxisTypeBarCategory |
|
66 | \value AxisTypeBarCategory | |
67 | \value AxisTypeCategory |
|
67 | \value AxisTypeCategory | |
68 | \value AxisTypeDateTime |
|
68 | \value AxisTypeDateTime | |
69 | */ |
|
69 | */ | |
70 |
|
70 | |||
71 | /*! |
|
71 | /*! | |
72 | *\fn void QAbstractAxis::type() const |
|
72 | *\fn void QAbstractAxis::type() const | |
73 | Returns the type of the axis |
|
73 | Returns the type of the axis | |
74 | */ |
|
74 | */ | |
75 |
|
75 | |||
76 | /*! |
|
76 | /*! | |
77 | \property QAbstractAxis::lineVisible |
|
77 | \property QAbstractAxis::lineVisible | |
78 | The visibility of the axis line |
|
78 | The visibility of the axis line | |
79 | */ |
|
79 | */ | |
80 | /*! |
|
80 | /*! | |
81 | \qmlproperty bool AbstractAxis::lineVisible |
|
81 | \qmlproperty bool AbstractAxis::lineVisible | |
82 | The visibility of the axis line |
|
82 | The visibility of the axis line | |
83 | */ |
|
83 | */ | |
84 |
|
84 | |||
85 | /*! |
|
85 | /*! | |
86 | \property QAbstractAxis::labelsVisible |
|
86 | \property QAbstractAxis::labelsVisible | |
87 | Defines if axis labels are visible. |
|
87 | Defines if axis labels are visible. | |
88 | */ |
|
88 | */ | |
89 | /*! |
|
89 | /*! | |
90 | \qmlproperty bool AbstractAxis::labelsVisible |
|
90 | \qmlproperty bool AbstractAxis::labelsVisible | |
91 | Defines if axis labels are visible. |
|
91 | Defines if axis labels are visible. | |
92 | */ |
|
92 | */ | |
93 |
|
93 | |||
94 | /*! |
|
94 | /*! | |
95 | \property QAbstractAxis::visible |
|
95 | \property QAbstractAxis::visible | |
96 | The visibility of the axis. |
|
96 | The visibility of the axis. | |
97 | */ |
|
97 | */ | |
98 | /*! |
|
98 | /*! | |
99 | \qmlproperty bool AbstractAxis::visible |
|
99 | \qmlproperty bool AbstractAxis::visible | |
100 | The visibility of the axis. |
|
100 | The visibility of the axis. | |
101 | */ |
|
101 | */ | |
102 |
|
102 | |||
103 | /*! |
|
103 | /*! | |
104 | \property QAbstractAxis::gridVisible |
|
104 | \property QAbstractAxis::gridVisible | |
105 | The visibility of the grid lines. |
|
105 | The visibility of the grid lines. | |
106 | */ |
|
106 | */ | |
107 | /*! |
|
107 | /*! | |
108 | \qmlproperty bool AbstractAxis::gridVisible |
|
108 | \qmlproperty bool AbstractAxis::gridVisible | |
109 | The visibility of the grid lines. |
|
109 | The visibility of the grid lines. | |
110 | */ |
|
110 | */ | |
111 |
|
111 | |||
112 | /*! |
|
112 | /*! | |
113 | \property QAbstractAxis::color |
|
113 | \property QAbstractAxis::color | |
114 | The color of the axis and ticks. |
|
114 | The color of the axis and ticks. | |
115 | */ |
|
115 | */ | |
116 | /*! |
|
116 | /*! | |
117 | \qmlproperty color AbstractAxis::color |
|
117 | \qmlproperty color AbstractAxis::color | |
118 | The color of the axis and ticks. |
|
118 | The color of the axis and ticks. | |
119 | */ |
|
119 | */ | |
120 |
|
120 | |||
121 | /*! |
|
121 | /*! | |
122 | \property QAbstractAxis::labelsFont |
|
122 | \property QAbstractAxis::labelsFont | |
123 | The font of the axis labels. |
|
123 | The font of the axis labels. | |
124 | */ |
|
124 | */ | |
125 |
|
125 | |||
126 | /*! |
|
126 | /*! | |
127 | \qmlproperty Font AbstractAxis::labelsFont |
|
127 | \qmlproperty Font AbstractAxis::labelsFont | |
128 | The font of the axis labels. |
|
128 | The font of the axis labels. | |
129 |
|
129 | |||
130 | See the \l {Font} {QML Font Element} for detailed documentation. |
|
130 | See the \l {Font} {QML Font Element} for detailed documentation. | |
131 | */ |
|
131 | */ | |
132 |
|
132 | |||
133 | /*! |
|
133 | /*! | |
134 | \property QAbstractAxis::labelsColor |
|
134 | \property QAbstractAxis::labelsColor | |
135 | The color of the axis labels. |
|
135 | The color of the axis labels. | |
136 | */ |
|
136 | */ | |
137 | /*! |
|
137 | /*! | |
138 | \qmlproperty color AbstractAxis::labelsColor |
|
138 | \qmlproperty color AbstractAxis::labelsColor | |
139 | The color of the axis labels. |
|
139 | The color of the axis labels. | |
140 | */ |
|
140 | */ | |
141 |
|
141 | |||
142 | /*! |
|
142 | /*! | |
143 | \property QAbstractAxis::labelsAngle |
|
143 | \property QAbstractAxis::labelsAngle | |
144 | The angle of the axis labels in degrees. |
|
144 | The angle of the axis labels in degrees. | |
145 | */ |
|
145 | */ | |
146 | /*! |
|
146 | /*! | |
147 | \qmlproperty int AbstractAxis::labelsAngle |
|
147 | \qmlproperty int AbstractAxis::labelsAngle | |
148 | The angle of the axis labels in degrees. |
|
148 | The angle of the axis labels in degrees. | |
149 | */ |
|
149 | */ | |
150 |
|
150 | |||
151 | /*! |
|
151 | /*! | |
152 | \property QAbstractAxis::shadesVisible |
|
152 | \property QAbstractAxis::shadesVisible | |
153 | The visibility of the axis shades. |
|
153 | The visibility of the axis shades. | |
154 | */ |
|
154 | */ | |
155 | /*! |
|
155 | /*! | |
156 | \qmlproperty bool AbstractAxis::shadesVisible |
|
156 | \qmlproperty bool AbstractAxis::shadesVisible | |
157 | The visibility of the axis shades. |
|
157 | The visibility of the axis shades. | |
158 | */ |
|
158 | */ | |
159 |
|
159 | |||
160 | /*! |
|
160 | /*! | |
161 | \property QAbstractAxis::shadesColor |
|
161 | \property QAbstractAxis::shadesColor | |
162 | The fill (brush) color of the axis shades. |
|
162 | The fill (brush) color of the axis shades. | |
163 | */ |
|
163 | */ | |
164 | /*! |
|
164 | /*! | |
165 | \qmlproperty color AbstractAxis::shadesColor |
|
165 | \qmlproperty color AbstractAxis::shadesColor | |
166 | The fill (brush) color of the axis shades. |
|
166 | The fill (brush) color of the axis shades. | |
167 | */ |
|
167 | */ | |
168 |
|
168 | |||
169 | /*! |
|
169 | /*! | |
170 | \property QAbstractAxis::shadesBorderColor |
|
170 | \property QAbstractAxis::shadesBorderColor | |
171 | The border (pen) color of the axis shades. |
|
171 | The border (pen) color of the axis shades. | |
172 | */ |
|
172 | */ | |
173 | /*! |
|
173 | /*! | |
174 | \qmlproperty color AbstractAxis::shadesBorderColor |
|
174 | \qmlproperty color AbstractAxis::shadesBorderColor | |
175 | The border (pen) color of the axis shades. |
|
175 | The border (pen) color of the axis shades. | |
176 | */ |
|
176 | */ | |
177 |
|
177 | |||
178 | /*! |
|
178 | /*! | |
179 | \property QAbstractAxis::titleVisible |
|
179 | \property QAbstractAxis::titleVisible | |
180 | The visibility of the axis title. By default the value is true. |
|
180 | The visibility of the axis title. By default the value is true. | |
181 | */ |
|
181 | */ | |
182 | /*! |
|
182 | /*! | |
183 | \qmlproperty bool AbstractAxis::titleVisible |
|
183 | \qmlproperty bool AbstractAxis::titleVisible | |
184 | The visibility of the axis title. By default the value is true. |
|
184 | The visibility of the axis title. By default the value is true. | |
185 | */ |
|
185 | */ | |
186 |
|
186 | |||
187 | /*! |
|
187 | /*! | |
188 | \property QAbstractAxis::titleFont |
|
188 | \property QAbstractAxis::titleFont | |
189 | The font of the title of the axis. |
|
189 | The font of the title of the axis. | |
190 | */ |
|
190 | */ | |
191 | /*! |
|
191 | /*! | |
192 | \qmlproperty Font AbstractAxis::title |
|
192 | \qmlproperty Font AbstractAxis::title | |
193 | The font of the title of the axis. |
|
193 | The font of the title of the axis. | |
194 | */ |
|
194 | */ | |
195 |
|
195 | |||
196 | /*! |
|
196 | /*! | |
197 | \property QAbstractAxis::title |
|
197 | \property QAbstractAxis::title | |
198 | The title of the axis. Empty by default. |
|
198 | The title of the axis. Empty by default. | |
199 | */ |
|
199 | */ | |
200 | /*! |
|
200 | /*! | |
201 | \qmlproperty string AbstractAxis::title |
|
201 | \qmlproperty string AbstractAxis::title | |
202 | The title of the axis. Empty string by default. |
|
202 | The title of the axis. Empty string by default. | |
203 | */ |
|
203 | */ | |
204 |
|
204 | |||
205 | /*! |
|
205 | /*! | |
206 | \property QAbstractAxis::alignment |
|
206 | \property QAbstractAxis::alignment | |
207 | The alignment of the axis. Either Qt::AlignLeft or Qt::AlignBottom. |
|
207 | The alignment of the axis. Either Qt::AlignLeft or Qt::AlignBottom. | |
208 | */ |
|
208 | */ | |
209 | /*! |
|
209 | /*! | |
210 | \qmlproperty alignment AbstractAxis::alignment |
|
210 | \qmlproperty alignment AbstractAxis::alignment | |
211 | The alignment of the axis. Either Qt.AlignLeft or Qt.AlignBottom. |
|
211 | The alignment of the axis. Either Qt.AlignLeft or Qt.AlignBottom. | |
212 | */ |
|
212 | */ | |
213 |
|
213 | |||
214 | /*! |
|
214 | /*! | |
215 | \fn void QAbstractAxis::visibleChanged(bool visible) |
|
215 | \fn void QAbstractAxis::visibleChanged(bool visible) | |
216 | Visibility of the axis has changed to \a visible. |
|
216 | Visibility of the axis has changed to \a visible. | |
217 | */ |
|
217 | */ | |
218 | /*! |
|
218 | /*! | |
219 | \qmlsignal AbstractAxis::onVisibleChanged(bool visible) |
|
219 | \qmlsignal AbstractAxis::onVisibleChanged(bool visible) | |
220 | Visibility of the axis has changed to \a visible. |
|
220 | Visibility of the axis has changed to \a visible. | |
221 | */ |
|
221 | */ | |
222 |
|
222 | |||
223 | /*! |
|
223 | /*! | |
224 | \fn void QAbstractAxis::lineVisibleChanged(bool visible) |
|
224 | \fn void QAbstractAxis::lineVisibleChanged(bool visible) | |
225 | Visibility of the axis line has changed to \a visible. |
|
225 | Visibility of the axis line has changed to \a visible. | |
226 | */ |
|
226 | */ | |
227 | /*! |
|
227 | /*! | |
228 | \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible) |
|
228 | \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible) | |
229 | Visibility of the axis line has changed to \a visible. |
|
229 | Visibility of the axis line has changed to \a visible. | |
230 | */ |
|
230 | */ | |
231 |
|
231 | |||
232 | /*! |
|
232 | /*! | |
233 | \fn void QAbstractAxis::labelsVisibleChanged(bool visible) |
|
233 | \fn void QAbstractAxis::labelsVisibleChanged(bool visible) | |
234 | Visibility of the labels of the axis has changed to \a visible. |
|
234 | Visibility of the labels of the axis has changed to \a visible. | |
235 | */ |
|
235 | */ | |
236 | /*! |
|
236 | /*! | |
237 | \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible) |
|
237 | \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible) | |
238 | Visibility of the labels of the axis has changed to \a visible. |
|
238 | Visibility of the labels of the axis has changed to \a visible. | |
239 | */ |
|
239 | */ | |
240 |
|
240 | |||
241 | /*! |
|
241 | /*! | |
242 | \fn void QAbstractAxis::gridVisibleChanged(bool visible) |
|
242 | \fn void QAbstractAxis::gridVisibleChanged(bool visible) | |
243 | Visibility of the grid lines of the axis has changed to \a visible. |
|
243 | Visibility of the grid lines of the axis has changed to \a visible. | |
244 | */ |
|
244 | */ | |
245 | /*! |
|
245 | /*! | |
246 | \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible) |
|
246 | \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible) | |
247 | Visibility of the grid lines of the axis has changed to \a visible. |
|
247 | Visibility of the grid lines of the axis has changed to \a visible. | |
248 | */ |
|
248 | */ | |
249 |
|
249 | |||
250 | /*! |
|
250 | /*! | |
251 | \fn void QAbstractAxis::colorChanged(QColor color) |
|
251 | \fn void QAbstractAxis::colorChanged(QColor color) | |
252 | Emitted if the \a color of the axis is changed. |
|
252 | Emitted if the \a color of the axis is changed. | |
253 | */ |
|
253 | */ | |
254 | /*! |
|
254 | /*! | |
255 | \qmlsignal AbstractAxis::onColorChanged(QColor color) |
|
255 | \qmlsignal AbstractAxis::onColorChanged(QColor color) | |
256 | Emitted if the \a color of the axis is changed. |
|
256 | Emitted if the \a color of the axis is changed. | |
257 | */ |
|
257 | */ | |
258 |
|
258 | |||
259 | /*! |
|
259 | /*! | |
260 | \fn void QAbstractAxis::labelsColorChanged(QColor color) |
|
260 | \fn void QAbstractAxis::labelsColorChanged(QColor color) | |
261 | Emitted if the \a color of the axis labels is changed. |
|
261 | Emitted if the \a color of the axis labels is changed. | |
262 | */ |
|
262 | */ | |
263 | /*! |
|
263 | /*! | |
264 | \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color) |
|
264 | \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color) | |
265 | Emitted if the \a color of the axis labels is changed. |
|
265 | Emitted if the \a color of the axis labels is changed. | |
266 | */ |
|
266 | */ | |
267 |
|
267 | |||
268 | /*! |
|
268 | /*! | |
269 | \fn void QAbstractAxis::shadesVisibleChanged(bool) |
|
269 | \fn void QAbstractAxis::shadesVisibleChanged(bool) | |
270 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
270 | Emitted if the visibility of the axis shades is changed to \a visible. | |
271 | */ |
|
271 | */ | |
272 | /*! |
|
272 | /*! | |
273 | \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible) |
|
273 | \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible) | |
274 | Emitted if the visibility of the axis shades is changed to \a visible. |
|
274 | Emitted if the visibility of the axis shades is changed to \a visible. | |
275 | */ |
|
275 | */ | |
276 |
|
276 | |||
277 | /*! |
|
277 | /*! | |
278 | \fn void QAbstractAxis::shadesColorChanged(QColor color) |
|
278 | \fn void QAbstractAxis::shadesColorChanged(QColor color) | |
279 | Emitted if the \a color of the axis shades is changed. |
|
279 | Emitted if the \a color of the axis shades is changed. | |
280 | */ |
|
280 | */ | |
281 | /*! |
|
281 | /*! | |
282 | \qmlsignal AbstractAxis::onShadesColorChanged(QColor color) |
|
282 | \qmlsignal AbstractAxis::onShadesColorChanged(QColor color) | |
283 | Emitted if the \a color of the axis shades is changed. |
|
283 | Emitted if the \a color of the axis shades is changed. | |
284 | */ |
|
284 | */ | |
285 |
|
285 | |||
286 | /*! |
|
286 | /*! | |
287 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) |
|
287 | \fn void QAbstractAxis::shadesBorderColorChanged(QColor) | |
288 | Emitted if the border \a color of the axis shades is changed. |
|
288 | Emitted if the border \a color of the axis shades is changed. | |
289 | */ |
|
289 | */ | |
290 | /*! |
|
290 | /*! | |
291 | \qmlsignal AbstractAxis::onBorderColorChanged(QColor color) |
|
291 | \qmlsignal AbstractAxis::onBorderColorChanged(QColor color) | |
292 | Emitted if the border \a color of the axis shades is changed. |
|
292 | Emitted if the border \a color of the axis shades is changed. | |
293 | */ |
|
293 | */ | |
294 |
|
294 | |||
295 | /*! |
|
295 | /*! | |
296 | \internal |
|
296 | \internal | |
297 | Constructs new axis object which is a child of \a parent. Ownership is taken by |
|
297 | Constructs new axis object which is a child of \a parent. Ownership is taken by | |
298 | QChart when axis added. |
|
298 | QChart when axis added. | |
299 | */ |
|
299 | */ | |
300 |
|
300 | |||
301 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) |
|
301 | QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent) | |
302 | : QObject(parent), |
|
302 | : QObject(parent), | |
303 | d_ptr(&d) |
|
303 | d_ptr(&d) | |
304 | { |
|
304 | { | |
305 | } |
|
305 | } | |
306 |
|
306 | |||
307 | /*! |
|
307 | /*! | |
308 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. |
|
308 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. | |
309 | */ |
|
309 | */ | |
310 |
|
310 | |||
311 | QAbstractAxis::~QAbstractAxis() |
|
311 | QAbstractAxis::~QAbstractAxis() | |
312 | { |
|
312 | { | |
313 | if (d_ptr->m_chart) |
|
313 | if (d_ptr->m_chart) | |
314 | qFatal("Still binded axis detected !"); |
|
314 | qFatal("Still binded axis detected !"); | |
315 | } |
|
315 | } | |
316 |
|
316 | |||
317 | /*! |
|
317 | /*! | |
318 | Sets \a pen used to draw axis line and ticks. |
|
318 | Sets \a pen used to draw axis line and ticks. | |
319 | */ |
|
319 | */ | |
320 | void QAbstractAxis::setLinePen(const QPen &pen) |
|
320 | void QAbstractAxis::setLinePen(const QPen &pen) | |
321 | { |
|
321 | { | |
322 | if (d_ptr->m_axisPen != pen) { |
|
322 | if (d_ptr->m_axisPen != pen) { | |
323 | d_ptr->m_axisPen = pen; |
|
323 | d_ptr->m_axisPen = pen; | |
324 | emit linePenChanged(pen); |
|
324 | emit linePenChanged(pen); | |
325 | } |
|
325 | } | |
326 | } |
|
326 | } | |
327 |
|
327 | |||
328 | /*! |
|
328 | /*! | |
329 | Returns pen used to draw axis and ticks. |
|
329 | Returns pen used to draw axis and ticks. | |
330 | */ |
|
330 | */ | |
331 | QPen QAbstractAxis::linePen() const |
|
331 | QPen QAbstractAxis::linePen() const | |
332 | { |
|
332 | { | |
333 | return d_ptr->m_axisPen; |
|
333 | return d_ptr->m_axisPen; | |
334 | } |
|
334 | } | |
335 |
|
335 | |||
336 | //TODO: remove me |
|
336 | //TODO: remove me | |
337 | void QAbstractAxis::setLinePenColor(QColor color) |
|
337 | void QAbstractAxis::setLinePenColor(QColor color) | |
338 | { |
|
338 | { | |
339 | QPen p = d_ptr->m_axisPen; |
|
339 | QPen p = d_ptr->m_axisPen; | |
340 | if (p.color() != color) { |
|
340 | if (p.color() != color) { | |
341 | p.setColor(color); |
|
341 | p.setColor(color); | |
342 | setLinePen(p); |
|
342 | setLinePen(p); | |
343 | emit colorChanged(color); |
|
343 | emit colorChanged(color); | |
344 | } |
|
344 | } | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
347 | QColor QAbstractAxis::linePenColor() const |
|
347 | QColor QAbstractAxis::linePenColor() const | |
348 | { |
|
348 | { | |
349 | return d_ptr->m_axisPen.color(); |
|
349 | return d_ptr->m_axisPen.color(); | |
350 | } |
|
350 | } | |
351 |
|
351 | |||
352 | /*! |
|
352 | /*! | |
353 | Sets if axis and ticks are \a visible. |
|
353 | Sets if axis and ticks are \a visible. | |
354 | */ |
|
354 | */ | |
355 | void QAbstractAxis::setLineVisible(bool visible) |
|
355 | void QAbstractAxis::setLineVisible(bool visible) | |
356 | { |
|
356 | { | |
357 | if (d_ptr->m_arrowVisible != visible) { |
|
357 | if (d_ptr->m_arrowVisible != visible) { | |
358 | d_ptr->m_arrowVisible = visible; |
|
358 | d_ptr->m_arrowVisible = visible; | |
359 | emit lineVisibleChanged(visible); |
|
359 | emit lineVisibleChanged(visible); | |
360 | } |
|
360 | } | |
361 | } |
|
361 | } | |
362 |
|
362 | |||
363 | bool QAbstractAxis::isLineVisible() const |
|
363 | bool QAbstractAxis::isLineVisible() const | |
364 | { |
|
364 | { | |
365 | return d_ptr->m_arrowVisible; |
|
365 | return d_ptr->m_arrowVisible; | |
366 | } |
|
366 | } | |
367 |
|
367 | |||
368 | void QAbstractAxis::setGridLineVisible(bool visible) |
|
368 | void QAbstractAxis::setGridLineVisible(bool visible) | |
369 | { |
|
369 | { | |
370 | if (d_ptr->m_gridLineVisible != visible) { |
|
370 | if (d_ptr->m_gridLineVisible != visible) { | |
371 | d_ptr->m_gridLineVisible = visible; |
|
371 | d_ptr->m_gridLineVisible = visible; | |
372 |
emit grid |
|
372 | emit gridVisibleChanged(visible); | |
373 | } |
|
373 | } | |
374 | } |
|
374 | } | |
375 |
|
375 | |||
376 | bool QAbstractAxis::isGridLineVisible() const |
|
376 | bool QAbstractAxis::isGridLineVisible() const | |
377 | { |
|
377 | { | |
378 | return d_ptr->m_gridLineVisible; |
|
378 | return d_ptr->m_gridLineVisible; | |
379 | } |
|
379 | } | |
380 |
|
380 | |||
381 | /*! |
|
381 | /*! | |
382 | Sets \a pen used to draw grid line. |
|
382 | Sets \a pen used to draw grid line. | |
383 | */ |
|
383 | */ | |
384 | void QAbstractAxis::setGridLinePen(const QPen &pen) |
|
384 | void QAbstractAxis::setGridLinePen(const QPen &pen) | |
385 | { |
|
385 | { | |
386 | if (d_ptr->m_gridLinePen != pen) { |
|
386 | if (d_ptr->m_gridLinePen != pen) { | |
387 | d_ptr->m_gridLinePen = pen; |
|
387 | d_ptr->m_gridLinePen = pen; | |
388 | emit gridLinePenChanged(pen); |
|
388 | emit gridLinePenChanged(pen); | |
389 | } |
|
389 | } | |
390 | } |
|
390 | } | |
391 |
|
391 | |||
392 | /*! |
|
392 | /*! | |
393 | Returns pen used to draw grid. |
|
393 | Returns pen used to draw grid. | |
394 | */ |
|
394 | */ | |
395 | QPen QAbstractAxis::gridLinePen() const |
|
395 | QPen QAbstractAxis::gridLinePen() const | |
396 | { |
|
396 | { | |
397 | return d_ptr->m_gridLinePen; |
|
397 | return d_ptr->m_gridLinePen; | |
398 | } |
|
398 | } | |
399 |
|
399 | |||
400 | void QAbstractAxis::setLabelsVisible(bool visible) |
|
400 | void QAbstractAxis::setLabelsVisible(bool visible) | |
401 | { |
|
401 | { | |
402 | if (d_ptr->m_labelsVisible != visible) { |
|
402 | if (d_ptr->m_labelsVisible != visible) { | |
403 | d_ptr->m_labelsVisible = visible; |
|
403 | d_ptr->m_labelsVisible = visible; | |
404 | emit labelsVisibleChanged(visible); |
|
404 | emit labelsVisibleChanged(visible); | |
405 | } |
|
405 | } | |
406 | } |
|
406 | } | |
407 |
|
407 | |||
408 | bool QAbstractAxis::labelsVisible() const |
|
408 | bool QAbstractAxis::labelsVisible() const | |
409 | { |
|
409 | { | |
410 | return d_ptr->m_labelsVisible; |
|
410 | return d_ptr->m_labelsVisible; | |
411 | } |
|
411 | } | |
412 |
|
412 | |||
413 | /*! |
|
413 | /*! | |
414 | Sets \a pen used to draw labels. |
|
414 | Sets \a pen used to draw labels. | |
415 | */ |
|
415 | */ | |
416 | void QAbstractAxis::setLabelsPen(const QPen &pen) |
|
416 | void QAbstractAxis::setLabelsPen(const QPen &pen) | |
417 | { |
|
417 | { | |
418 | if (d_ptr->m_labelsPen != pen) { |
|
418 | if (d_ptr->m_labelsPen != pen) { | |
419 | d_ptr->m_labelsPen = pen; |
|
419 | d_ptr->m_labelsPen = pen; | |
420 | emit labelsPenChanged(pen); |
|
420 | emit labelsPenChanged(pen); | |
421 | } |
|
421 | } | |
422 | } |
|
422 | } | |
423 |
|
423 | |||
424 | /*! |
|
424 | /*! | |
425 | Returns the pen used to labels. |
|
425 | Returns the pen used to labels. | |
426 | */ |
|
426 | */ | |
427 | QPen QAbstractAxis::labelsPen() const |
|
427 | QPen QAbstractAxis::labelsPen() const | |
428 | { |
|
428 | { | |
429 | return d_ptr->m_labelsPen; |
|
429 | return d_ptr->m_labelsPen; | |
430 | } |
|
430 | } | |
431 |
|
431 | |||
432 | /*! |
|
432 | /*! | |
433 | Sets \a brush used to draw labels. |
|
433 | Sets \a brush used to draw labels. | |
434 | */ |
|
434 | */ | |
435 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) |
|
435 | void QAbstractAxis::setLabelsBrush(const QBrush &brush) | |
436 | { |
|
436 | { | |
437 | if (d_ptr->m_labelsBrush != brush) { |
|
437 | if (d_ptr->m_labelsBrush != brush) { | |
438 | d_ptr->m_labelsBrush = brush; |
|
438 | d_ptr->m_labelsBrush = brush; | |
439 | emit labelsBrushChanged(brush); |
|
439 | emit labelsBrushChanged(brush); | |
440 | } |
|
440 | } | |
441 | } |
|
441 | } | |
442 |
|
442 | |||
443 | /*! |
|
443 | /*! | |
444 | Returns brush used to draw labels. |
|
444 | Returns brush used to draw labels. | |
445 | */ |
|
445 | */ | |
446 | QBrush QAbstractAxis::labelsBrush() const |
|
446 | QBrush QAbstractAxis::labelsBrush() const | |
447 | { |
|
447 | { | |
448 | return d_ptr->m_labelsBrush; |
|
448 | return d_ptr->m_labelsBrush; | |
449 | } |
|
449 | } | |
450 |
|
450 | |||
451 | /*! |
|
451 | /*! | |
452 | Sets \a font used to draw labels. |
|
452 | Sets \a font used to draw labels. | |
453 | */ |
|
453 | */ | |
454 | void QAbstractAxis::setLabelsFont(const QFont &font) |
|
454 | void QAbstractAxis::setLabelsFont(const QFont &font) | |
455 | { |
|
455 | { | |
456 | if (d_ptr->m_labelsFont != font) { |
|
456 | if (d_ptr->m_labelsFont != font) { | |
457 | d_ptr->m_labelsFont = font; |
|
457 | d_ptr->m_labelsFont = font; | |
458 | emit labelsFontChanged(font); |
|
458 | emit labelsFontChanged(font); | |
459 | } |
|
459 | } | |
460 | } |
|
460 | } | |
461 |
|
461 | |||
462 | /*! |
|
462 | /*! | |
463 | Returns font used to draw labels. |
|
463 | Returns font used to draw labels. | |
464 | */ |
|
464 | */ | |
465 | QFont QAbstractAxis::labelsFont() const |
|
465 | QFont QAbstractAxis::labelsFont() const | |
466 | { |
|
466 | { | |
467 | return d_ptr->m_labelsFont; |
|
467 | return d_ptr->m_labelsFont; | |
468 | } |
|
468 | } | |
469 |
|
469 | |||
470 | void QAbstractAxis::setLabelsAngle(int angle) |
|
470 | void QAbstractAxis::setLabelsAngle(int angle) | |
471 | { |
|
471 | { | |
472 | if (d_ptr->m_labelsAngle != angle) { |
|
472 | if (d_ptr->m_labelsAngle != angle) { | |
473 | d_ptr->m_labelsAngle = angle; |
|
473 | d_ptr->m_labelsAngle = angle; | |
474 | emit labelsAngleChanged(angle); |
|
474 | emit labelsAngleChanged(angle); | |
475 | } |
|
475 | } | |
476 | } |
|
476 | } | |
477 |
|
477 | |||
478 | int QAbstractAxis::labelsAngle() const |
|
478 | int QAbstractAxis::labelsAngle() const | |
479 | { |
|
479 | { | |
480 | return d_ptr->m_labelsAngle; |
|
480 | return d_ptr->m_labelsAngle; | |
481 | } |
|
481 | } | |
482 | //TODO: remove me |
|
482 | //TODO: remove me | |
483 | void QAbstractAxis::setLabelsColor(QColor color) |
|
483 | void QAbstractAxis::setLabelsColor(QColor color) | |
484 | { |
|
484 | { | |
485 | QBrush b = d_ptr->m_labelsBrush; |
|
485 | QBrush b = d_ptr->m_labelsBrush; | |
486 | if (b.color() != color) { |
|
486 | if (b.color() != color) { | |
487 | b.setColor(color); |
|
487 | b.setColor(color); | |
488 | setLabelsBrush(b); |
|
488 | setLabelsBrush(b); | |
489 | emit labelsColorChanged(color); |
|
489 | emit labelsColorChanged(color); | |
490 | } |
|
490 | } | |
491 | } |
|
491 | } | |
492 |
|
492 | |||
493 | QColor QAbstractAxis::labelsColor() const |
|
493 | QColor QAbstractAxis::labelsColor() const | |
494 | { |
|
494 | { | |
495 | return d_ptr->m_labelsBrush.color(); |
|
495 | return d_ptr->m_labelsBrush.color(); | |
496 | } |
|
496 | } | |
497 |
|
497 | |||
498 | void QAbstractAxis::setTitleVisible(bool visible) |
|
498 | void QAbstractAxis::setTitleVisible(bool visible) | |
499 | { |
|
499 | { | |
500 | if (d_ptr->m_titleVisible != visible) { |
|
500 | if (d_ptr->m_titleVisible != visible) { | |
501 | d_ptr->m_titleVisible = visible; |
|
501 | d_ptr->m_titleVisible = visible; | |
502 | emit labelsVisibleChanged(visible); |
|
502 | emit labelsVisibleChanged(visible); | |
503 | } |
|
503 | } | |
504 | } |
|
504 | } | |
505 |
|
505 | |||
506 | bool QAbstractAxis::titleVisible() const |
|
506 | bool QAbstractAxis::titleVisible() const | |
507 | { |
|
507 | { | |
508 | return d_ptr->m_titleVisible; |
|
508 | return d_ptr->m_titleVisible; | |
509 | } |
|
509 | } | |
510 |
|
510 | |||
511 | /*! |
|
511 | /*! | |
512 | Sets \a pen used to draw title. |
|
512 | Sets \a pen used to draw title. | |
513 | */ |
|
513 | */ | |
514 | void QAbstractAxis::setTitlePen(const QPen &pen) |
|
514 | void QAbstractAxis::setTitlePen(const QPen &pen) | |
515 | { |
|
515 | { | |
516 | if (d_ptr->m_titlePen != pen) { |
|
516 | if (d_ptr->m_titlePen != pen) { | |
517 | d_ptr->m_titlePen = pen; |
|
517 | d_ptr->m_titlePen = pen; | |
518 | emit titlePenChanged(pen); |
|
518 | emit titlePenChanged(pen); | |
519 | } |
|
519 | } | |
520 | } |
|
520 | } | |
521 |
|
521 | |||
522 | /*! |
|
522 | /*! | |
523 | Returns the pen used to title. |
|
523 | Returns the pen used to title. | |
524 | */ |
|
524 | */ | |
525 | QPen QAbstractAxis::titlePen() const |
|
525 | QPen QAbstractAxis::titlePen() const | |
526 | { |
|
526 | { | |
527 | return d_ptr->m_titlePen; |
|
527 | return d_ptr->m_titlePen; | |
528 | } |
|
528 | } | |
529 |
|
529 | |||
530 | /*! |
|
530 | /*! | |
531 | Sets \a brush used to draw title. |
|
531 | Sets \a brush used to draw title. | |
532 | */ |
|
532 | */ | |
533 | void QAbstractAxis::setTitleBrush(const QBrush &brush) |
|
533 | void QAbstractAxis::setTitleBrush(const QBrush &brush) | |
534 | { |
|
534 | { | |
535 | if (d_ptr->m_titleBrush != brush) { |
|
535 | if (d_ptr->m_titleBrush != brush) { | |
536 | d_ptr->m_titleBrush = brush; |
|
536 | d_ptr->m_titleBrush = brush; | |
537 | emit titleBrushChanged(brush); |
|
537 | emit titleBrushChanged(brush); | |
538 | } |
|
538 | } | |
539 | } |
|
539 | } | |
540 |
|
540 | |||
541 | /*! |
|
541 | /*! | |
542 | Returns brush used to draw title. |
|
542 | Returns brush used to draw title. | |
543 | */ |
|
543 | */ | |
544 | QBrush QAbstractAxis::titleBrush() const |
|
544 | QBrush QAbstractAxis::titleBrush() const | |
545 | { |
|
545 | { | |
546 | return d_ptr->m_titleBrush; |
|
546 | return d_ptr->m_titleBrush; | |
547 | } |
|
547 | } | |
548 |
|
548 | |||
549 | /*! |
|
549 | /*! | |
550 | Sets \a font used to draw title. |
|
550 | Sets \a font used to draw title. | |
551 | */ |
|
551 | */ | |
552 | void QAbstractAxis::setTitleFont(const QFont &font) |
|
552 | void QAbstractAxis::setTitleFont(const QFont &font) | |
553 | { |
|
553 | { | |
554 | if (d_ptr->m_titleFont != font) { |
|
554 | if (d_ptr->m_titleFont != font) { | |
555 | d_ptr->m_titleFont = font; |
|
555 | d_ptr->m_titleFont = font; | |
556 | emit titleFontChanged(font); |
|
556 | emit titleFontChanged(font); | |
557 | } |
|
557 | } | |
558 | } |
|
558 | } | |
559 |
|
559 | |||
560 | /*! |
|
560 | /*! | |
561 | Returns font used to draw title. |
|
561 | Returns font used to draw title. | |
562 | */ |
|
562 | */ | |
563 | QFont QAbstractAxis::titleFont() const |
|
563 | QFont QAbstractAxis::titleFont() const | |
564 | { |
|
564 | { | |
565 | return d_ptr->m_titleFont; |
|
565 | return d_ptr->m_titleFont; | |
566 | } |
|
566 | } | |
567 |
|
567 | |||
568 | void QAbstractAxis::setTitleText(const QString &title) |
|
568 | void QAbstractAxis::setTitleText(const QString &title) | |
569 | { |
|
569 | { | |
570 | if (d_ptr->m_title != title) { |
|
570 | if (d_ptr->m_title != title) { | |
571 | d_ptr->m_title = title; |
|
571 | d_ptr->m_title = title; | |
572 | emit titleTextChanged(title); |
|
572 | emit titleTextChanged(title); | |
573 | } |
|
573 | } | |
574 | } |
|
574 | } | |
575 |
|
575 | |||
576 | QString QAbstractAxis::titleText() const |
|
576 | QString QAbstractAxis::titleText() const | |
577 | { |
|
577 | { | |
578 | return d_ptr->m_title; |
|
578 | return d_ptr->m_title; | |
579 | } |
|
579 | } | |
580 |
|
580 | |||
581 |
|
581 | |||
582 | void QAbstractAxis::setShadesVisible(bool visible) |
|
582 | void QAbstractAxis::setShadesVisible(bool visible) | |
583 | { |
|
583 | { | |
584 | if (d_ptr->m_shadesVisible != visible) { |
|
584 | if (d_ptr->m_shadesVisible != visible) { | |
585 | d_ptr->m_shadesVisible = visible; |
|
585 | d_ptr->m_shadesVisible = visible; | |
586 | emit shadesVisibleChanged(visible); |
|
586 | emit shadesVisibleChanged(visible); | |
587 | } |
|
587 | } | |
588 | } |
|
588 | } | |
589 |
|
589 | |||
590 | bool QAbstractAxis::shadesVisible() const |
|
590 | bool QAbstractAxis::shadesVisible() const | |
591 | { |
|
591 | { | |
592 | return d_ptr->m_shadesVisible; |
|
592 | return d_ptr->m_shadesVisible; | |
593 | } |
|
593 | } | |
594 |
|
594 | |||
595 | /*! |
|
595 | /*! | |
596 | Sets \a pen used to draw shades. |
|
596 | Sets \a pen used to draw shades. | |
597 | */ |
|
597 | */ | |
598 | void QAbstractAxis::setShadesPen(const QPen &pen) |
|
598 | void QAbstractAxis::setShadesPen(const QPen &pen) | |
599 | { |
|
599 | { | |
600 | if (d_ptr->m_shadesPen != pen) { |
|
600 | if (d_ptr->m_shadesPen != pen) { | |
601 | d_ptr->m_shadesPen = pen; |
|
601 | d_ptr->m_shadesPen = pen; | |
602 | emit shadesPenChanged(pen); |
|
602 | emit shadesPenChanged(pen); | |
603 | } |
|
603 | } | |
604 | } |
|
604 | } | |
605 |
|
605 | |||
606 | /*! |
|
606 | /*! | |
607 | Returns pen used to draw shades. |
|
607 | Returns pen used to draw shades. | |
608 | */ |
|
608 | */ | |
609 | QPen QAbstractAxis::shadesPen() const |
|
609 | QPen QAbstractAxis::shadesPen() const | |
610 | { |
|
610 | { | |
611 | return d_ptr->m_shadesPen; |
|
611 | return d_ptr->m_shadesPen; | |
612 | } |
|
612 | } | |
613 |
|
613 | |||
614 | /*! |
|
614 | /*! | |
615 | Sets \a brush used to draw shades. |
|
615 | Sets \a brush used to draw shades. | |
616 | */ |
|
616 | */ | |
617 | void QAbstractAxis::setShadesBrush(const QBrush &brush) |
|
617 | void QAbstractAxis::setShadesBrush(const QBrush &brush) | |
618 | { |
|
618 | { | |
619 | if (d_ptr->m_shadesBrush != brush) { |
|
619 | if (d_ptr->m_shadesBrush != brush) { | |
620 | d_ptr->m_shadesBrush = brush; |
|
620 | d_ptr->m_shadesBrush = brush; | |
621 | emit shadesBrushChanged(brush); |
|
621 | emit shadesBrushChanged(brush); | |
622 | } |
|
622 | } | |
623 | } |
|
623 | } | |
624 |
|
624 | |||
625 | /*! |
|
625 | /*! | |
626 | Returns brush used to draw shades. |
|
626 | Returns brush used to draw shades. | |
627 | */ |
|
627 | */ | |
628 | QBrush QAbstractAxis::shadesBrush() const |
|
628 | QBrush QAbstractAxis::shadesBrush() const | |
629 | { |
|
629 | { | |
630 | return d_ptr->m_shadesBrush; |
|
630 | return d_ptr->m_shadesBrush; | |
631 | } |
|
631 | } | |
632 |
|
632 | |||
633 | void QAbstractAxis::setShadesColor(QColor color) |
|
633 | void QAbstractAxis::setShadesColor(QColor color) | |
634 | { |
|
634 | { | |
635 | QBrush b = d_ptr->m_shadesBrush; |
|
635 | QBrush b = d_ptr->m_shadesBrush; | |
636 | if (b.color() != color) { |
|
636 | if (b.color() != color) { | |
637 | b.setColor(color); |
|
637 | b.setColor(color); | |
638 | setShadesBrush(b); |
|
638 | setShadesBrush(b); | |
639 | emit shadesColorChanged(color); |
|
639 | emit shadesColorChanged(color); | |
640 | } |
|
640 | } | |
641 | } |
|
641 | } | |
642 |
|
642 | |||
643 | QColor QAbstractAxis::shadesColor() const |
|
643 | QColor QAbstractAxis::shadesColor() const | |
644 | { |
|
644 | { | |
645 | return d_ptr->m_shadesBrush.color(); |
|
645 | return d_ptr->m_shadesBrush.color(); | |
646 | } |
|
646 | } | |
647 |
|
647 | |||
648 | void QAbstractAxis::setShadesBorderColor(QColor color) |
|
648 | void QAbstractAxis::setShadesBorderColor(QColor color) | |
649 | { |
|
649 | { | |
650 | QPen p = d_ptr->m_shadesPen; |
|
650 | QPen p = d_ptr->m_shadesPen; | |
651 | if (p.color() != color) { |
|
651 | if (p.color() != color) { | |
652 | p.setColor(color); |
|
652 | p.setColor(color); | |
653 | setShadesPen(p); |
|
653 | setShadesPen(p); | |
654 | emit shadesColorChanged(color); |
|
654 | emit shadesColorChanged(color); | |
655 | } |
|
655 | } | |
656 | } |
|
656 | } | |
657 |
|
657 | |||
658 | QColor QAbstractAxis::shadesBorderColor() const |
|
658 | QColor QAbstractAxis::shadesBorderColor() const | |
659 | { |
|
659 | { | |
660 | return d_ptr->m_shadesPen.color(); |
|
660 | return d_ptr->m_shadesPen.color(); | |
661 | } |
|
661 | } | |
662 |
|
662 | |||
663 |
|
663 | |||
664 | bool QAbstractAxis::isVisible() const |
|
664 | bool QAbstractAxis::isVisible() const | |
665 | { |
|
665 | { | |
666 | return d_ptr->m_visible; |
|
666 | return d_ptr->m_visible; | |
667 | } |
|
667 | } | |
668 |
|
668 | |||
669 | /*! |
|
669 | /*! | |
670 | Sets axis, shades, labels and grid lines to be visible. |
|
670 | Sets axis, shades, labels and grid lines to be visible. | |
671 | */ |
|
671 | */ | |
672 | void QAbstractAxis::setVisible(bool visible) |
|
672 | void QAbstractAxis::setVisible(bool visible) | |
673 | { |
|
673 | { | |
674 | if (d_ptr->m_visible != visible) { |
|
674 | if (d_ptr->m_visible != visible) { | |
675 | d_ptr->m_visible = visible; |
|
675 | d_ptr->m_visible = visible; | |
676 | emit visibleChanged(visible); |
|
676 | emit visibleChanged(visible); | |
677 | } |
|
677 | } | |
678 | } |
|
678 | } | |
679 |
|
679 | |||
680 |
|
680 | |||
681 | /*! |
|
681 | /*! | |
682 | Sets axis, shades, labels and grid lines to be visible. |
|
682 | Sets axis, shades, labels and grid lines to be visible. | |
683 | */ |
|
683 | */ | |
684 | void QAbstractAxis::show() |
|
684 | void QAbstractAxis::show() | |
685 | { |
|
685 | { | |
686 | setVisible(true); |
|
686 | setVisible(true); | |
687 | } |
|
687 | } | |
688 |
|
688 | |||
689 | /*! |
|
689 | /*! | |
690 | Sets axis, shades, labels and grid lines to not be visible. |
|
690 | Sets axis, shades, labels and grid lines to not be visible. | |
691 | */ |
|
691 | */ | |
692 | void QAbstractAxis::hide() |
|
692 | void QAbstractAxis::hide() | |
693 | { |
|
693 | { | |
694 | setVisible(false); |
|
694 | setVisible(false); | |
695 | } |
|
695 | } | |
696 |
|
696 | |||
697 | /*! |
|
697 | /*! | |
698 | Sets the minimum value shown on the axis. |
|
698 | Sets the minimum value shown on the axis. | |
699 | Depending on the actual axis type the \a min parameter is converted to appropriate type. |
|
699 | Depending on the actual axis type the \a min parameter is converted to appropriate type. | |
700 | If the conversion is impossible then the function call does nothing |
|
700 | If the conversion is impossible then the function call does nothing | |
701 | */ |
|
701 | */ | |
702 | void QAbstractAxis::setMin(const QVariant &min) |
|
702 | void QAbstractAxis::setMin(const QVariant &min) | |
703 | { |
|
703 | { | |
704 | d_ptr->setMin(min); |
|
704 | d_ptr->setMin(min); | |
705 | } |
|
705 | } | |
706 |
|
706 | |||
707 | /*! |
|
707 | /*! | |
708 | Sets the maximum value shown on the axis. |
|
708 | Sets the maximum value shown on the axis. | |
709 | Depending on the actual axis type the \a max parameter is converted to appropriate type. |
|
709 | Depending on the actual axis type the \a max parameter is converted to appropriate type. | |
710 | If the conversion is impossible then the function call does nothing |
|
710 | If the conversion is impossible then the function call does nothing | |
711 | */ |
|
711 | */ | |
712 | void QAbstractAxis::setMax(const QVariant &max) |
|
712 | void QAbstractAxis::setMax(const QVariant &max) | |
713 | { |
|
713 | { | |
714 | d_ptr->setMax(max); |
|
714 | d_ptr->setMax(max); | |
715 | } |
|
715 | } | |
716 |
|
716 | |||
717 | /*! |
|
717 | /*! | |
718 | Sets the range shown on the axis. |
|
718 | Sets the range shown on the axis. | |
719 | Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types. |
|
719 | Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types. | |
720 | If the conversion is impossible then the function call does nothing. |
|
720 | If the conversion is impossible then the function call does nothing. | |
721 | */ |
|
721 | */ | |
722 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) |
|
722 | void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |
723 | { |
|
723 | { | |
724 | d_ptr->setRange(min, max); |
|
724 | d_ptr->setRange(min, max); | |
725 | } |
|
725 | } | |
726 |
|
726 | |||
727 |
|
727 | |||
728 | /*! |
|
728 | /*! | |
729 | Returns the orientation in which the axis is being used (Vertical or Horizontal) |
|
729 | Returns the orientation in which the axis is being used (Vertical or Horizontal) | |
730 | */ |
|
730 | */ | |
731 | // NOTE: should have const but it breaks BC: |
|
731 | // NOTE: should have const but it breaks BC: | |
732 | // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function |
|
732 | // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function | |
733 | Qt::Orientation QAbstractAxis::orientation() |
|
733 | Qt::Orientation QAbstractAxis::orientation() | |
734 | { |
|
734 | { | |
735 | return d_ptr->orientation(); |
|
735 | return d_ptr->orientation(); | |
736 | } |
|
736 | } | |
737 |
|
737 | |||
738 | Qt::Alignment QAbstractAxis::alignment() const |
|
738 | Qt::Alignment QAbstractAxis::alignment() const | |
739 | { |
|
739 | { | |
740 | return d_ptr->alignment(); |
|
740 | return d_ptr->alignment(); | |
741 | } |
|
741 | } | |
742 |
|
742 | |||
743 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
743 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
744 |
|
744 | |||
745 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) |
|
745 | QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q) | |
746 | : q_ptr(q), |
|
746 | : q_ptr(q), | |
747 | m_chart(0), |
|
747 | m_chart(0), | |
748 | m_orientation(Qt::Orientation(0)), |
|
748 | m_orientation(Qt::Orientation(0)), | |
749 | m_alignment(0), |
|
749 | m_alignment(0), | |
750 | m_visible(true), |
|
750 | m_visible(true), | |
751 | m_arrowVisible(true), |
|
751 | m_arrowVisible(true), | |
752 | m_gridLineVisible(true), |
|
752 | m_gridLineVisible(true), | |
753 | m_labelsVisible(true), |
|
753 | m_labelsVisible(true), | |
754 | m_labelsAngle(0), |
|
754 | m_labelsAngle(0), | |
755 | m_shadesVisible(false), |
|
755 | m_shadesVisible(false), | |
756 | m_shadesBrush(Qt::SolidPattern), |
|
756 | m_shadesBrush(Qt::SolidPattern), | |
757 | m_shadesOpacity(1.0), |
|
757 | m_shadesOpacity(1.0), | |
758 | m_dirty(false) |
|
758 | m_dirty(false) | |
759 | { |
|
759 | { | |
760 |
|
760 | |||
761 | } |
|
761 | } | |
762 |
|
762 | |||
763 | QAbstractAxisPrivate::~QAbstractAxisPrivate() |
|
763 | QAbstractAxisPrivate::~QAbstractAxisPrivate() | |
764 | { |
|
764 | { | |
765 | } |
|
765 | } | |
766 |
|
766 | |||
767 | void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment) |
|
767 | void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment) | |
768 | { |
|
768 | { | |
769 | switch(alignment) { |
|
769 | switch(alignment) { | |
770 | case Qt::AlignTop: |
|
770 | case Qt::AlignTop: | |
771 | case Qt::AlignBottom: |
|
771 | case Qt::AlignBottom: | |
772 | m_orientation = Qt::Horizontal; |
|
772 | m_orientation = Qt::Horizontal; | |
773 | break; |
|
773 | break; | |
774 | case Qt::AlignLeft: |
|
774 | case Qt::AlignLeft: | |
775 | case Qt::AlignRight: |
|
775 | case Qt::AlignRight: | |
776 | m_orientation = Qt::Vertical; |
|
776 | m_orientation = Qt::Vertical; | |
777 | break; |
|
777 | break; | |
778 | default: |
|
778 | default: | |
779 | qWarning()<<"No alignment specified !"; |
|
779 | qWarning()<<"No alignment specified !"; | |
780 | break; |
|
780 | break; | |
781 | }; |
|
781 | }; | |
782 | m_alignment=alignment; |
|
782 | m_alignment=alignment; | |
783 | } |
|
783 | } | |
784 |
|
784 | |||
785 | void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) |
|
785 | void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) | |
786 | { |
|
786 | { | |
787 | QPen pen; |
|
787 | QPen pen; | |
788 | QBrush brush; |
|
788 | QBrush brush; | |
789 | QFont font; |
|
789 | QFont font; | |
790 |
|
790 | |||
791 | bool axisX = m_orientation == Qt::Horizontal; |
|
791 | bool axisX = m_orientation == Qt::Horizontal; | |
792 |
|
792 | |||
793 | if (m_arrowVisible) { |
|
793 | if (m_arrowVisible) { | |
794 |
|
794 | |||
795 | if (forced || brush == m_labelsBrush){ |
|
795 | if (forced || brush == m_labelsBrush){ | |
796 | q_ptr->setLabelsBrush(theme->labelBrush()); |
|
796 | q_ptr->setLabelsBrush(theme->labelBrush()); | |
797 | } |
|
797 | } | |
798 | //TODO: introduce axis brush |
|
798 | //TODO: introduce axis brush | |
799 | if (forced || brush == m_titleBrush){ |
|
799 | if (forced || brush == m_titleBrush){ | |
800 | q_ptr->setTitleBrush(theme->labelBrush()); |
|
800 | q_ptr->setTitleBrush(theme->labelBrush()); | |
801 | } |
|
801 | } | |
802 | if (forced || pen == m_labelsPen){ |
|
802 | if (forced || pen == m_labelsPen){ | |
803 | q_ptr->setLabelsPen(Qt::NoPen);// NoPen for performance reasons |
|
803 | q_ptr->setLabelsPen(Qt::NoPen);// NoPen for performance reasons | |
804 | } |
|
804 | } | |
805 | if (forced || pen == m_titlePen){ |
|
805 | if (forced || pen == m_titlePen){ | |
806 | q_ptr->setTitlePen(Qt::NoPen);// Noen for performance reasons |
|
806 | q_ptr->setTitlePen(Qt::NoPen);// Noen for performance reasons | |
807 | } |
|
807 | } | |
808 | if (forced || m_shadesVisible) { |
|
808 | if (forced || m_shadesVisible) { | |
809 |
|
809 | |||
810 | if (forced || brush == m_shadesBrush){ |
|
810 | if (forced || brush == m_shadesBrush){ | |
811 | q_ptr->setShadesBrush(theme->backgroundShadesBrush()); |
|
811 | q_ptr->setShadesBrush(theme->backgroundShadesBrush()); | |
812 | } |
|
812 | } | |
813 | if (forced || pen == m_shadesPen){ |
|
813 | if (forced || pen == m_shadesPen){ | |
814 | q_ptr->setShadesPen(theme->backgroundShadesPen()); |
|
814 | q_ptr->setShadesPen(theme->backgroundShadesPen()); | |
815 | } |
|
815 | } | |
816 | if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth |
|
816 | if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth | |
817 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX) |
|
817 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX) | |
818 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) { |
|
818 | || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) { | |
819 | q_ptr->setShadesVisible(true); |
|
819 | q_ptr->setShadesVisible(true); | |
820 | } |
|
820 | } | |
821 | } |
|
821 | } | |
822 |
|
822 | |||
823 | if (forced || pen == m_axisPen) { |
|
823 | if (forced || pen == m_axisPen) { | |
824 | q_ptr->setLinePen(theme->axisLinePen()); |
|
824 | q_ptr->setLinePen(theme->axisLinePen()); | |
825 | } |
|
825 | } | |
826 |
|
826 | |||
827 | if (forced || pen == m_gridLinePen) { |
|
827 | if (forced || pen == m_gridLinePen) { | |
828 | q_ptr->setGridLinePen(theme->girdLinePen()); |
|
828 | q_ptr->setGridLinePen(theme->girdLinePen()); | |
829 | } |
|
829 | } | |
830 |
|
830 | |||
831 | if (forced || font == m_labelsFont){ |
|
831 | if (forced || font == m_labelsFont){ | |
832 | q_ptr->setLabelsFont(theme->labelFont()); |
|
832 | q_ptr->setLabelsFont(theme->labelFont()); | |
833 | } |
|
833 | } | |
834 | //TODO: discuss with Tero |
|
834 | //TODO: discuss with Tero | |
835 | if (forced || font == m_titleFont){ |
|
835 | if (forced || font == m_titleFont){ | |
836 | QFont font(m_labelsFont); |
|
836 | QFont font(m_labelsFont); | |
837 | font.setBold(true); |
|
837 | font.setBold(true); | |
838 | q_ptr->setTitleFont(font); |
|
838 | q_ptr->setTitleFont(font); | |
839 | } |
|
839 | } | |
840 | } |
|
840 | } | |
841 | } |
|
841 | } | |
842 |
|
842 | |||
843 | void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max) |
|
843 | void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max) | |
844 | { |
|
844 | { | |
845 | setRange(min,max); |
|
845 | setRange(min,max); | |
846 | } |
|
846 | } | |
847 |
|
847 | |||
848 | void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) |
|
848 | void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) | |
849 | { |
|
849 | { | |
850 | Q_UNUSED(parent); |
|
850 | Q_UNUSED(parent); | |
851 | } |
|
851 | } | |
852 |
|
852 | |||
853 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options) |
|
853 | void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options) | |
854 | { |
|
854 | { | |
855 | ChartAxis* axis = m_item.data(); |
|
855 | ChartAxis* axis = m_item.data(); | |
856 | Q_ASSERT(axis); |
|
856 | Q_ASSERT(axis); | |
857 | if(options.testFlag(QChart::GridAxisAnimations)) { |
|
857 | if(options.testFlag(QChart::GridAxisAnimations)) { | |
858 | axis->setAnimation(new AxisAnimation(axis)); |
|
858 | axis->setAnimation(new AxisAnimation(axis)); | |
859 | }else{ |
|
859 | }else{ | |
860 | axis->setAnimation(0); |
|
860 | axis->setAnimation(0); | |
861 | } |
|
861 | } | |
862 | } |
|
862 | } | |
863 |
|
863 | |||
864 |
|
864 | |||
865 | #include "moc_qabstractaxis.cpp" |
|
865 | #include "moc_qabstractaxis.cpp" | |
866 | #include "moc_qabstractaxis_p.cpp" |
|
866 | #include "moc_qabstractaxis_p.cpp" | |
867 |
|
867 | |||
868 | QTCOMMERCIALCHART_END_NAMESPACE |
|
868 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,196 +1,196 | |||||
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 | #ifndef QABSTRACTAXIS_H |
|
21 | #ifndef QABSTRACTAXIS_H | |
22 | #define QABSTRACTAXIS_H |
|
22 | #define QABSTRACTAXIS_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <QPen> |
|
25 | #include <QPen> | |
26 | #include <QFont> |
|
26 | #include <QFont> | |
27 | #include <QVariant> |
|
27 | #include <QVariant> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class QAbstractAxisPrivate; |
|
31 | class QAbstractAxisPrivate; | |
32 |
|
32 | |||
33 | class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject |
|
33 | class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | //visibility |
|
36 | //visibility | |
37 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) |
|
37 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) | |
38 | //arrow |
|
38 | //arrow | |
39 | Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged) |
|
39 | Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged) | |
40 | Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged) |
|
40 | Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged) | |
41 | //TODO: make wrapping of color for qml |
|
41 | //TODO: make wrapping of color for qml | |
42 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) |
|
42 | Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged) | |
43 | //labels |
|
43 | //labels | |
44 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
44 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) | |
45 | Q_PROPERTY(QPen lablesPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) |
|
45 | Q_PROPERTY(QPen lablesPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) | |
46 | Q_PROPERTY(QBrush lablesBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) |
|
46 | Q_PROPERTY(QBrush lablesBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) | |
47 | //TODO: fix labels angles to work with layout |
|
47 | //TODO: fix labels angles to work with layout | |
48 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) |
|
48 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) | |
49 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) |
|
49 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) | |
50 | //TODO: make wrapping of color for qml |
|
50 | //TODO: make wrapping of color for qml | |
51 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) |
|
51 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) | |
52 | //grid |
|
52 | //grid | |
53 |
Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY grid |
|
53 | Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged) | |
54 | Q_PROPERTY(QPen girdLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged) |
|
54 | Q_PROPERTY(QPen girdLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged) | |
55 | //shades |
|
55 | //shades | |
56 | Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged) |
|
56 | Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged) | |
57 | //TODO: make wrapping of color for qml |
|
57 | //TODO: make wrapping of color for qml | |
58 | Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged) |
|
58 | Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged) | |
59 | //TODO: make wrapping of border for qml |
|
59 | //TODO: make wrapping of border for qml | |
60 | Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged) |
|
60 | Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged) | |
61 | Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged) |
|
61 | Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged) | |
62 | Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged) |
|
62 | Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged) | |
63 | //title |
|
63 | //title | |
64 | Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged) |
|
64 | Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged) | |
65 | Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged) |
|
65 | Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged) | |
66 | Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged) |
|
66 | Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged) | |
67 | Q_PROPERTY(bool titleVisible READ titleVisible WRITE setTitleVisible) |
|
67 | Q_PROPERTY(bool titleVisible READ titleVisible WRITE setTitleVisible) | |
68 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) |
|
68 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) | |
69 | //orientation |
|
69 | //orientation | |
70 | Q_PROPERTY(Qt::Orientation orinetation READ orientation) |
|
70 | Q_PROPERTY(Qt::Orientation orinetation READ orientation) | |
71 | //aligment |
|
71 | //aligment | |
72 | Q_PROPERTY(Qt::Alignment alignment READ alignment) |
|
72 | Q_PROPERTY(Qt::Alignment alignment READ alignment) | |
73 |
|
73 | |||
74 | public: |
|
74 | public: | |
75 |
|
75 | |||
76 | enum AxisType { |
|
76 | enum AxisType { | |
77 | AxisTypeNoAxis = 0x0, |
|
77 | AxisTypeNoAxis = 0x0, | |
78 | AxisTypeValue = 0x1, |
|
78 | AxisTypeValue = 0x1, | |
79 | AxisTypeBarCategory = 0x2, |
|
79 | AxisTypeBarCategory = 0x2, | |
80 | AxisTypeCategory = 0x3, |
|
80 | AxisTypeCategory = 0x3, | |
81 | AxisTypeDateTime = 0x4, |
|
81 | AxisTypeDateTime = 0x4, | |
82 | AxisTypeLogValue = 0x5 |
|
82 | AxisTypeLogValue = 0x5 | |
83 | }; |
|
83 | }; | |
84 |
|
84 | |||
85 | Q_DECLARE_FLAGS(AxisTypes, AxisType) |
|
85 | Q_DECLARE_FLAGS(AxisTypes, AxisType) | |
86 |
|
86 | |||
87 | protected: |
|
87 | protected: | |
88 | explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0); |
|
88 | explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0); | |
89 |
|
89 | |||
90 | public: |
|
90 | public: | |
91 | ~QAbstractAxis(); |
|
91 | ~QAbstractAxis(); | |
92 |
|
92 | |||
93 | virtual AxisType type() const = 0; |
|
93 | virtual AxisType type() const = 0; | |
94 |
|
94 | |||
95 | //visibility handling |
|
95 | //visibility handling | |
96 | bool isVisible() const; |
|
96 | bool isVisible() const; | |
97 | void setVisible(bool visible = true); |
|
97 | void setVisible(bool visible = true); | |
98 | void show(); |
|
98 | void show(); | |
99 | void hide(); |
|
99 | void hide(); | |
100 |
|
100 | |||
101 | //arrow handling |
|
101 | //arrow handling | |
102 | bool isLineVisible() const; |
|
102 | bool isLineVisible() const; | |
103 | void setLineVisible(bool visible = true); |
|
103 | void setLineVisible(bool visible = true); | |
104 | void setLinePen(const QPen &pen); |
|
104 | void setLinePen(const QPen &pen); | |
105 | QPen linePen() const; |
|
105 | QPen linePen() const; | |
106 | void setLinePenColor(QColor color); |
|
106 | void setLinePenColor(QColor color); | |
107 | QColor linePenColor() const; |
|
107 | QColor linePenColor() const; | |
108 |
|
108 | |||
109 | //grid handling |
|
109 | //grid handling | |
110 | bool isGridLineVisible() const; |
|
110 | bool isGridLineVisible() const; | |
111 | void setGridLineVisible(bool visible = true); |
|
111 | void setGridLineVisible(bool visible = true); | |
112 | void setGridLinePen(const QPen &pen); |
|
112 | void setGridLinePen(const QPen &pen); | |
113 | QPen gridLinePen() const; |
|
113 | QPen gridLinePen() const; | |
114 |
|
114 | |||
115 | //labels handling |
|
115 | //labels handling | |
116 | bool labelsVisible() const; |
|
116 | bool labelsVisible() const; | |
117 | void setLabelsVisible(bool visible = true); |
|
117 | void setLabelsVisible(bool visible = true); | |
118 | void setLabelsPen(const QPen &pen); |
|
118 | void setLabelsPen(const QPen &pen); | |
119 | QPen labelsPen() const; |
|
119 | QPen labelsPen() const; | |
120 | void setLabelsBrush(const QBrush &brush); |
|
120 | void setLabelsBrush(const QBrush &brush); | |
121 | QBrush labelsBrush() const; |
|
121 | QBrush labelsBrush() const; | |
122 | void setLabelsFont(const QFont &font); |
|
122 | void setLabelsFont(const QFont &font); | |
123 | QFont labelsFont() const; |
|
123 | QFont labelsFont() const; | |
124 | void setLabelsAngle(int angle); |
|
124 | void setLabelsAngle(int angle); | |
125 | int labelsAngle() const; |
|
125 | int labelsAngle() const; | |
126 | void setLabelsColor(QColor color); |
|
126 | void setLabelsColor(QColor color); | |
127 | QColor labelsColor() const; |
|
127 | QColor labelsColor() const; | |
128 |
|
128 | |||
129 | //title handling |
|
129 | //title handling | |
130 | bool titleVisible() const; |
|
130 | bool titleVisible() const; | |
131 | void setTitleVisible(bool visible = true); |
|
131 | void setTitleVisible(bool visible = true); | |
132 | void setTitlePen(const QPen &pen); |
|
132 | void setTitlePen(const QPen &pen); | |
133 | QPen titlePen() const; |
|
133 | QPen titlePen() const; | |
134 | void setTitleBrush(const QBrush &brush); |
|
134 | void setTitleBrush(const QBrush &brush); | |
135 | QBrush titleBrush() const; |
|
135 | QBrush titleBrush() const; | |
136 | void setTitleFont(const QFont &font); |
|
136 | void setTitleFont(const QFont &font); | |
137 | QFont titleFont() const; |
|
137 | QFont titleFont() const; | |
138 | void setTitleText(const QString &title); |
|
138 | void setTitleText(const QString &title); | |
139 | QString titleText() const; |
|
139 | QString titleText() const; | |
140 |
|
140 | |||
141 | //shades handling |
|
141 | //shades handling | |
142 | bool shadesVisible() const; |
|
142 | bool shadesVisible() const; | |
143 | void setShadesVisible(bool visible = true); |
|
143 | void setShadesVisible(bool visible = true); | |
144 | void setShadesPen(const QPen &pen); |
|
144 | void setShadesPen(const QPen &pen); | |
145 | QPen shadesPen() const; |
|
145 | QPen shadesPen() const; | |
146 | void setShadesBrush(const QBrush &brush); |
|
146 | void setShadesBrush(const QBrush &brush); | |
147 | QBrush shadesBrush() const; |
|
147 | QBrush shadesBrush() const; | |
148 | void setShadesColor(QColor color); |
|
148 | void setShadesColor(QColor color); | |
149 | QColor shadesColor() const; |
|
149 | QColor shadesColor() const; | |
150 | void setShadesBorderColor(QColor color); |
|
150 | void setShadesBorderColor(QColor color); | |
151 | QColor shadesBorderColor() const; |
|
151 | QColor shadesBorderColor() const; | |
152 |
|
152 | |||
153 | Qt::Orientation orientation(); //TODO: missing const <- BC |
|
153 | Qt::Orientation orientation(); //TODO: missing const <- BC | |
154 | Qt::Alignment alignment() const; |
|
154 | Qt::Alignment alignment() const; | |
155 |
|
155 | |||
156 | //range handling |
|
156 | //range handling | |
157 | void setMin(const QVariant &min); |
|
157 | void setMin(const QVariant &min); | |
158 | void setMax(const QVariant &max); |
|
158 | void setMax(const QVariant &max); | |
159 | void setRange(const QVariant &min, const QVariant &max); |
|
159 | void setRange(const QVariant &min, const QVariant &max); | |
160 |
|
160 | |||
161 | Q_SIGNALS: |
|
161 | Q_SIGNALS: | |
162 | void visibleChanged(bool visible); |
|
162 | void visibleChanged(bool visible); | |
163 | void linePenChanged(const QPen& pen); |
|
163 | void linePenChanged(const QPen& pen); | |
164 | void lineVisibleChanged(bool visible); |
|
164 | void lineVisibleChanged(bool visible); | |
165 | void labelsVisibleChanged(bool visible); |
|
165 | void labelsVisibleChanged(bool visible); | |
166 | void labelsPenChanged(const QPen& pen); |
|
166 | void labelsPenChanged(const QPen& pen); | |
167 | void labelsBrushChanged(const QBrush& brush); |
|
167 | void labelsBrushChanged(const QBrush& brush); | |
168 | void labelsFontChanged(const QFont& pen); |
|
168 | void labelsFontChanged(const QFont& pen); | |
169 | void labelsAngleChanged(int angle); |
|
169 | void labelsAngleChanged(int angle); | |
170 | void gridLinePenChanged(const QPen& pen); |
|
170 | void gridLinePenChanged(const QPen& pen); | |
171 |
void grid |
|
171 | void gridVisibleChanged(bool visible); | |
172 | void colorChanged(QColor color); |
|
172 | void colorChanged(QColor color); | |
173 | void labelsColorChanged(QColor color); |
|
173 | void labelsColorChanged(QColor color); | |
174 | void titleTextChanged(const QString& title); |
|
174 | void titleTextChanged(const QString& title); | |
175 | void titlePenChanged(const QPen& pen); |
|
175 | void titlePenChanged(const QPen& pen); | |
176 | void titleBrushChanged(const QBrush brush); |
|
176 | void titleBrushChanged(const QBrush brush); | |
177 | void titleVisibleChanged(bool visible); |
|
177 | void titleVisibleChanged(bool visible); | |
178 | void titleFontChanged(const QFont& font); |
|
178 | void titleFontChanged(const QFont& font); | |
179 | void shadesVisibleChanged(bool visible); |
|
179 | void shadesVisibleChanged(bool visible); | |
180 | void shadesColorChanged(QColor color); |
|
180 | void shadesColorChanged(QColor color); | |
181 | void shadesBorderColorChanged(QColor color); |
|
181 | void shadesBorderColorChanged(QColor color); | |
182 | void shadesPenChanged(const QPen& pen); |
|
182 | void shadesPenChanged(const QPen& pen); | |
183 | void shadesBrushChanged(const QBrush brush); |
|
183 | void shadesBrushChanged(const QBrush brush); | |
184 |
|
184 | |||
185 | protected: |
|
185 | protected: | |
186 | QScopedPointer<QAbstractAxisPrivate> d_ptr; |
|
186 | QScopedPointer<QAbstractAxisPrivate> d_ptr; | |
187 | Q_DISABLE_COPY(QAbstractAxis) |
|
187 | Q_DISABLE_COPY(QAbstractAxis) | |
188 | friend class ChartDataSet; |
|
188 | friend class ChartDataSet; | |
189 | friend class ChartAxis; |
|
189 | friend class ChartAxis; | |
190 | friend class ChartPresenter; |
|
190 | friend class ChartPresenter; | |
191 | friend class ChartThemeManager; |
|
191 | friend class ChartThemeManager; | |
192 | }; |
|
192 | }; | |
193 |
|
193 | |||
194 | QTCOMMERCIALCHART_END_NAMESPACE |
|
194 | QTCOMMERCIALCHART_END_NAMESPACE | |
195 |
|
195 | |||
196 | #endif // QABSTRACTAXIS_H |
|
196 | #endif // QABSTRACTAXIS_H |
@@ -1,847 +1,847 | |||||
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 | #include "tst_qabstractaxis.h" |
|
21 | #include "tst_qabstractaxis.h" | |
22 |
|
22 | |||
23 | Q_DECLARE_METATYPE(QPen) |
|
23 | Q_DECLARE_METATYPE(QPen) | |
24 | Q_DECLARE_METATYPE(Qt::Orientation) |
|
24 | Q_DECLARE_METATYPE(Qt::Orientation) | |
25 |
|
25 | |||
26 | void tst_QAbstractAxis::initTestCase() |
|
26 | void tst_QAbstractAxis::initTestCase() | |
27 | { |
|
27 | { | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | void tst_QAbstractAxis::cleanupTestCase() |
|
30 | void tst_QAbstractAxis::cleanupTestCase() | |
31 | { |
|
31 | { | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series) |
|
34 | void tst_QAbstractAxis::init(QAbstractAxis* axis, QAbstractSeries* series) | |
35 | { |
|
35 | { | |
36 | m_axis = axis; |
|
36 | m_axis = axis; | |
37 | m_series = series; |
|
37 | m_series = series; | |
38 | m_view = new QChartView(new QChart()); |
|
38 | m_view = new QChartView(new QChart()); | |
39 | m_chart = m_view->chart(); |
|
39 | m_chart = m_view->chart(); | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | void tst_QAbstractAxis::cleanup() |
|
42 | void tst_QAbstractAxis::cleanup() | |
43 | { |
|
43 | { | |
44 | delete m_view; |
|
44 | delete m_view; | |
45 | m_view = 0; |
|
45 | m_view = 0; | |
46 | m_chart = 0; |
|
46 | m_chart = 0; | |
47 | m_axis = 0; |
|
47 | m_axis = 0; | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | void tst_QAbstractAxis::qabstractaxis() |
|
50 | void tst_QAbstractAxis::qabstractaxis() | |
51 | { |
|
51 | { | |
52 | QCOMPARE(m_axis->linePen(), QPen()); |
|
52 | QCOMPARE(m_axis->linePen(), QPen()); | |
53 | //TODO QCOMPARE(m_axis->axisPenColor(), QColor()); |
|
53 | //TODO QCOMPARE(m_axis->axisPenColor(), QColor()); | |
54 | QCOMPARE(m_axis->gridLinePen(), QPen()); |
|
54 | QCOMPARE(m_axis->gridLinePen(), QPen()); | |
55 | QCOMPARE(m_axis->isLineVisible(), true); |
|
55 | QCOMPARE(m_axis->isLineVisible(), true); | |
56 | QCOMPARE(m_axis->isGridLineVisible(), true); |
|
56 | QCOMPARE(m_axis->isGridLineVisible(), true); | |
57 | QCOMPARE(m_axis->isVisible(), true); |
|
57 | QCOMPARE(m_axis->isVisible(), true); | |
58 | QCOMPARE(m_axis->labelsAngle(), 0); |
|
58 | QCOMPARE(m_axis->labelsAngle(), 0); | |
59 | QCOMPARE(m_axis->labelsBrush(), QBrush()); |
|
59 | QCOMPARE(m_axis->labelsBrush(), QBrush()); | |
60 | //TODO QCOMPARE(m_axis->labelsColor(), QColor()); |
|
60 | //TODO QCOMPARE(m_axis->labelsColor(), QColor()); | |
61 | QCOMPARE(m_axis->labelsFont(), QFont()); |
|
61 | QCOMPARE(m_axis->labelsFont(), QFont()); | |
62 | QCOMPARE(m_axis->labelsPen(), QPen()); |
|
62 | QCOMPARE(m_axis->labelsPen(), QPen()); | |
63 | QCOMPARE(m_axis->labelsVisible(), true); |
|
63 | QCOMPARE(m_axis->labelsVisible(), true); | |
64 | QCOMPARE(m_axis->orientation(), Qt::Orientation(0)); |
|
64 | QCOMPARE(m_axis->orientation(), Qt::Orientation(0)); | |
65 | m_axis->setLineVisible(false); |
|
65 | m_axis->setLineVisible(false); | |
66 | m_axis->setLinePen(QPen()); |
|
66 | m_axis->setLinePen(QPen()); | |
67 | m_axis->setLinePenColor(QColor()); |
|
67 | m_axis->setLinePenColor(QColor()); | |
68 | m_axis->setGridLinePen(QPen()); |
|
68 | m_axis->setGridLinePen(QPen()); | |
69 | m_axis->setGridLineVisible(false); |
|
69 | m_axis->setGridLineVisible(false); | |
70 | m_axis->setLabelsAngle(-1); |
|
70 | m_axis->setLabelsAngle(-1); | |
71 | m_axis->setLabelsBrush(QBrush()); |
|
71 | m_axis->setLabelsBrush(QBrush()); | |
72 | m_axis->setLabelsColor(QColor()); |
|
72 | m_axis->setLabelsColor(QColor()); | |
73 | m_axis->setLabelsFont(QFont()); |
|
73 | m_axis->setLabelsFont(QFont()); | |
74 | m_axis->setLabelsPen(QPen()); |
|
74 | m_axis->setLabelsPen(QPen()); | |
75 | m_axis->setLabelsVisible(false); |
|
75 | m_axis->setLabelsVisible(false); | |
76 | m_axis->setMax(QVariant()); |
|
76 | m_axis->setMax(QVariant()); | |
77 | m_axis->setMin(QVariant()); |
|
77 | m_axis->setMin(QVariant()); | |
78 | m_axis->setRange(QVariant(), QVariant()); |
|
78 | m_axis->setRange(QVariant(), QVariant()); | |
79 | m_axis->setShadesBorderColor(QColor()); |
|
79 | m_axis->setShadesBorderColor(QColor()); | |
80 | m_axis->setShadesBrush(QBrush()); |
|
80 | m_axis->setShadesBrush(QBrush()); | |
81 | m_axis->setShadesColor(QColor()); |
|
81 | m_axis->setShadesColor(QColor()); | |
82 | m_axis->setShadesPen(QPen()); |
|
82 | m_axis->setShadesPen(QPen()); | |
83 | m_axis->setShadesVisible(false); |
|
83 | m_axis->setShadesVisible(false); | |
84 | m_axis->setVisible(false); |
|
84 | m_axis->setVisible(false); | |
85 | //TODO QCOMPARE(m_axis->shadesBorderColor(), QColor()); |
|
85 | //TODO QCOMPARE(m_axis->shadesBorderColor(), QColor()); | |
86 | //TODO QCOMPARE(m_axis->shadesBrush(), QBrush()); |
|
86 | //TODO QCOMPARE(m_axis->shadesBrush(), QBrush()); | |
87 | //TODO QCOMPARE(m_axis->shadesColor(), QColor()); |
|
87 | //TODO QCOMPARE(m_axis->shadesColor(), QColor()); | |
88 | QCOMPARE(m_axis->shadesPen(), QPen()); |
|
88 | QCOMPARE(m_axis->shadesPen(), QPen()); | |
89 | QCOMPARE(m_axis->shadesVisible(), false); |
|
89 | QCOMPARE(m_axis->shadesVisible(), false); | |
90 | m_axis->show(); |
|
90 | m_axis->show(); | |
91 | m_axis->hide(); |
|
91 | m_axis->hide(); | |
92 | } |
|
92 | } | |
93 |
|
93 | |||
94 | void tst_QAbstractAxis::axisPen_data() |
|
94 | void tst_QAbstractAxis::axisPen_data() | |
95 | { |
|
95 | { | |
96 | QTest::addColumn<QPen>("axisPen"); |
|
96 | QTest::addColumn<QPen>("axisPen"); | |
97 | QTest::newRow("null") << QPen(); |
|
97 | QTest::newRow("null") << QPen(); | |
98 | QTest::newRow("blue") << QPen(Qt::blue); |
|
98 | QTest::newRow("blue") << QPen(Qt::blue); | |
99 | QTest::newRow("black") << QPen(Qt::black); |
|
99 | QTest::newRow("black") << QPen(Qt::black); | |
100 | QTest::newRow("red") << QPen(Qt::red); |
|
100 | QTest::newRow("red") << QPen(Qt::red); | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | void tst_QAbstractAxis::axisPen() |
|
103 | void tst_QAbstractAxis::axisPen() | |
104 | { |
|
104 | { | |
105 | QFETCH(QPen, axisPen); |
|
105 | QFETCH(QPen, axisPen); | |
106 |
|
106 | |||
107 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
107 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
108 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
108 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
109 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
109 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
110 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
110 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
111 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
111 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
112 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
112 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
113 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
113 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
114 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
114 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
115 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
115 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
116 |
|
116 | |||
117 | m_axis->setLinePen(axisPen); |
|
117 | m_axis->setLinePen(axisPen); | |
118 | QCOMPARE(m_axis->linePen(), axisPen); |
|
118 | QCOMPARE(m_axis->linePen(), axisPen); | |
119 |
|
119 | |||
120 | QCOMPARE(spy0.count(), 0); |
|
120 | QCOMPARE(spy0.count(), 0); | |
121 | QCOMPARE(spy1.count(), 0); |
|
121 | QCOMPARE(spy1.count(), 0); | |
122 | QCOMPARE(spy2.count(), 0); |
|
122 | QCOMPARE(spy2.count(), 0); | |
123 | QCOMPARE(spy3.count(), 0); |
|
123 | QCOMPARE(spy3.count(), 0); | |
124 | QCOMPARE(spy4.count(), 0); |
|
124 | QCOMPARE(spy4.count(), 0); | |
125 | QCOMPARE(spy5.count(), 0); |
|
125 | QCOMPARE(spy5.count(), 0); | |
126 | QCOMPARE(spy6.count(), 0); |
|
126 | QCOMPARE(spy6.count(), 0); | |
127 | QCOMPARE(spy7.count(), 0); |
|
127 | QCOMPARE(spy7.count(), 0); | |
128 | QCOMPARE(spy8.count(), 0); |
|
128 | QCOMPARE(spy8.count(), 0); | |
129 |
|
129 | |||
130 | m_chart->setAxisX(m_axis, m_series); |
|
130 | m_chart->setAxisX(m_axis, m_series); | |
131 | m_view->show(); |
|
131 | m_view->show(); | |
132 | QTest::qWaitForWindowShown(m_view); |
|
132 | QTest::qWaitForWindowShown(m_view); | |
133 | //TODO QCOMPARE(m_axis->axisPen(), axisPen); |
|
133 | //TODO QCOMPARE(m_axis->axisPen(), axisPen); | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | void tst_QAbstractAxis::axisPenColor_data() |
|
136 | void tst_QAbstractAxis::axisPenColor_data() | |
137 | { |
|
137 | { | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | void tst_QAbstractAxis::axisPenColor() |
|
140 | void tst_QAbstractAxis::axisPenColor() | |
141 | { |
|
141 | { | |
142 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); |
|
142 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 | void tst_QAbstractAxis::gridLinePen_data() |
|
145 | void tst_QAbstractAxis::gridLinePen_data() | |
146 | { |
|
146 | { | |
147 |
|
147 | |||
148 | QTest::addColumn<QPen>("gridLinePen"); |
|
148 | QTest::addColumn<QPen>("gridLinePen"); | |
149 | QTest::newRow("null") << QPen(); |
|
149 | QTest::newRow("null") << QPen(); | |
150 | QTest::newRow("blue") << QPen(Qt::blue); |
|
150 | QTest::newRow("blue") << QPen(Qt::blue); | |
151 | QTest::newRow("black") << QPen(Qt::black); |
|
151 | QTest::newRow("black") << QPen(Qt::black); | |
152 | QTest::newRow("red") << QPen(Qt::red); |
|
152 | QTest::newRow("red") << QPen(Qt::red); | |
153 |
|
153 | |||
154 | } |
|
154 | } | |
155 |
|
155 | |||
156 | void tst_QAbstractAxis::gridLinePen() |
|
156 | void tst_QAbstractAxis::gridLinePen() | |
157 | { |
|
157 | { | |
158 | QFETCH(QPen, gridLinePen); |
|
158 | QFETCH(QPen, gridLinePen); | |
159 |
|
159 | |||
160 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
160 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
161 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
161 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
162 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
162 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
163 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
163 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
164 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
164 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
165 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
165 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
166 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
166 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
167 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
167 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
168 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
168 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
169 |
|
169 | |||
170 | m_axis->setGridLinePen(gridLinePen); |
|
170 | m_axis->setGridLinePen(gridLinePen); | |
171 | QCOMPARE(m_axis->gridLinePen(), gridLinePen); |
|
171 | QCOMPARE(m_axis->gridLinePen(), gridLinePen); | |
172 |
|
172 | |||
173 | QCOMPARE(spy0.count(), 0); |
|
173 | QCOMPARE(spy0.count(), 0); | |
174 | QCOMPARE(spy1.count(), 0); |
|
174 | QCOMPARE(spy1.count(), 0); | |
175 | QCOMPARE(spy2.count(), 0); |
|
175 | QCOMPARE(spy2.count(), 0); | |
176 | QCOMPARE(spy3.count(), 0); |
|
176 | QCOMPARE(spy3.count(), 0); | |
177 | QCOMPARE(spy4.count(), 0); |
|
177 | QCOMPARE(spy4.count(), 0); | |
178 | QCOMPARE(spy5.count(), 0); |
|
178 | QCOMPARE(spy5.count(), 0); | |
179 | QCOMPARE(spy6.count(), 0); |
|
179 | QCOMPARE(spy6.count(), 0); | |
180 | QCOMPARE(spy7.count(), 0); |
|
180 | QCOMPARE(spy7.count(), 0); | |
181 | QCOMPARE(spy8.count(), 0); |
|
181 | QCOMPARE(spy8.count(), 0); | |
182 |
|
182 | |||
183 | m_chart->setAxisX(m_axis, m_series); |
|
183 | m_chart->setAxisX(m_axis, m_series); | |
184 | m_view->show(); |
|
184 | m_view->show(); | |
185 | QTest::qWaitForWindowShown(m_view); |
|
185 | QTest::qWaitForWindowShown(m_view); | |
186 | //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen); |
|
186 | //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen); | |
187 | } |
|
187 | } | |
188 |
|
188 | |||
189 | void tst_QAbstractAxis::lineVisible_data() |
|
189 | void tst_QAbstractAxis::lineVisible_data() | |
190 | { |
|
190 | { | |
191 | QTest::addColumn<bool>("lineVisible"); |
|
191 | QTest::addColumn<bool>("lineVisible"); | |
192 | QTest::newRow("true") << true; |
|
192 | QTest::newRow("true") << true; | |
193 | QTest::newRow("false") << false; |
|
193 | QTest::newRow("false") << false; | |
194 | } |
|
194 | } | |
195 |
|
195 | |||
196 | void tst_QAbstractAxis::lineVisible() |
|
196 | void tst_QAbstractAxis::lineVisible() | |
197 | { |
|
197 | { | |
198 | QFETCH(bool, lineVisible); |
|
198 | QFETCH(bool, lineVisible); | |
199 |
|
199 | |||
200 | m_axis->setLineVisible(!lineVisible); |
|
200 | m_axis->setLineVisible(!lineVisible); | |
201 |
|
201 | |||
202 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
202 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
203 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
203 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
204 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
204 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
205 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
205 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
206 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
206 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
207 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
207 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
208 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
208 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
209 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
209 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
210 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
210 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
211 |
|
211 | |||
212 | m_axis->setLineVisible(lineVisible); |
|
212 | m_axis->setLineVisible(lineVisible); | |
213 | QCOMPARE(m_axis->isLineVisible(), lineVisible); |
|
213 | QCOMPARE(m_axis->isLineVisible(), lineVisible); | |
214 |
|
214 | |||
215 | QCOMPARE(spy0.count(), 1); |
|
215 | QCOMPARE(spy0.count(), 1); | |
216 | QCOMPARE(spy1.count(), 0); |
|
216 | QCOMPARE(spy1.count(), 0); | |
217 | QCOMPARE(spy2.count(), 0); |
|
217 | QCOMPARE(spy2.count(), 0); | |
218 | QCOMPARE(spy3.count(), 0); |
|
218 | QCOMPARE(spy3.count(), 0); | |
219 | QCOMPARE(spy4.count(), 0); |
|
219 | QCOMPARE(spy4.count(), 0); | |
220 | QCOMPARE(spy5.count(), 0); |
|
220 | QCOMPARE(spy5.count(), 0); | |
221 | QCOMPARE(spy6.count(), 0); |
|
221 | QCOMPARE(spy6.count(), 0); | |
222 | QCOMPARE(spy7.count(), 0); |
|
222 | QCOMPARE(spy7.count(), 0); | |
223 | QCOMPARE(spy8.count(), 0); |
|
223 | QCOMPARE(spy8.count(), 0); | |
224 |
|
224 | |||
225 | m_chart->setAxisX(m_axis, m_series); |
|
225 | m_chart->setAxisX(m_axis, m_series); | |
226 | m_view->show(); |
|
226 | m_view->show(); | |
227 | QTest::qWaitForWindowShown(m_view); |
|
227 | QTest::qWaitForWindowShown(m_view); | |
228 | QCOMPARE(m_axis->isLineVisible(), lineVisible); |
|
228 | QCOMPARE(m_axis->isLineVisible(), lineVisible); | |
229 | } |
|
229 | } | |
230 |
|
230 | |||
231 | void tst_QAbstractAxis::gridLineVisible_data() |
|
231 | void tst_QAbstractAxis::gridLineVisible_data() | |
232 | { |
|
232 | { | |
233 | QTest::addColumn<bool>("gridLineVisible"); |
|
233 | QTest::addColumn<bool>("gridLineVisible"); | |
234 | QTest::newRow("true") << true; |
|
234 | QTest::newRow("true") << true; | |
235 | QTest::newRow("false") << false; |
|
235 | QTest::newRow("false") << false; | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | void tst_QAbstractAxis::gridLineVisible() |
|
238 | void tst_QAbstractAxis::gridLineVisible() | |
239 | { |
|
239 | { | |
240 | QFETCH(bool, gridLineVisible); |
|
240 | QFETCH(bool, gridLineVisible); | |
241 |
|
241 | |||
242 | m_axis->setGridLineVisible(!gridLineVisible); |
|
242 | m_axis->setGridLineVisible(!gridLineVisible); | |
243 |
|
243 | |||
244 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
244 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
245 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
245 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
246 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
246 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
247 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
247 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
248 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
248 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
249 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
249 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
250 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
250 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
251 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
251 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
252 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
252 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
253 |
|
253 | |||
254 | m_axis->setGridLineVisible(gridLineVisible); |
|
254 | m_axis->setGridLineVisible(gridLineVisible); | |
255 | QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); |
|
255 | QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); | |
256 |
|
256 | |||
257 | QCOMPARE(spy0.count(), 0); |
|
257 | QCOMPARE(spy0.count(), 0); | |
258 | QCOMPARE(spy1.count(), 0); |
|
258 | QCOMPARE(spy1.count(), 0); | |
259 | QCOMPARE(spy2.count(), 1); |
|
259 | QCOMPARE(spy2.count(), 1); | |
260 | QCOMPARE(spy3.count(), 0); |
|
260 | QCOMPARE(spy3.count(), 0); | |
261 | QCOMPARE(spy4.count(), 0); |
|
261 | QCOMPARE(spy4.count(), 0); | |
262 | QCOMPARE(spy5.count(), 0); |
|
262 | QCOMPARE(spy5.count(), 0); | |
263 | QCOMPARE(spy6.count(), 0); |
|
263 | QCOMPARE(spy6.count(), 0); | |
264 | QCOMPARE(spy7.count(), 0); |
|
264 | QCOMPARE(spy7.count(), 0); | |
265 | QCOMPARE(spy8.count(), 0); |
|
265 | QCOMPARE(spy8.count(), 0); | |
266 |
|
266 | |||
267 | m_chart->setAxisX(m_axis, m_series); |
|
267 | m_chart->setAxisX(m_axis, m_series); | |
268 | m_view->show(); |
|
268 | m_view->show(); | |
269 | QTest::qWaitForWindowShown(m_view); |
|
269 | QTest::qWaitForWindowShown(m_view); | |
270 | QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); |
|
270 | QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible); | |
271 |
|
271 | |||
272 | } |
|
272 | } | |
273 |
|
273 | |||
274 | void tst_QAbstractAxis::visible_data() |
|
274 | void tst_QAbstractAxis::visible_data() | |
275 | { |
|
275 | { | |
276 | QTest::addColumn<bool>("visible"); |
|
276 | QTest::addColumn<bool>("visible"); | |
277 | QTest::newRow("true") << true; |
|
277 | QTest::newRow("true") << true; | |
278 | QTest::newRow("false") << false; |
|
278 | QTest::newRow("false") << false; | |
279 | } |
|
279 | } | |
280 |
|
280 | |||
281 | void tst_QAbstractAxis::visible() |
|
281 | void tst_QAbstractAxis::visible() | |
282 | { |
|
282 | { | |
283 | QFETCH(bool, visible); |
|
283 | QFETCH(bool, visible); | |
284 |
|
284 | |||
285 | m_axis->setVisible(!visible); |
|
285 | m_axis->setVisible(!visible); | |
286 |
|
286 | |||
287 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
287 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
288 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
288 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
289 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
289 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
290 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
290 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
291 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
291 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
292 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
292 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
293 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
293 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
294 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
294 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
295 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
295 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
296 |
|
296 | |||
297 | m_axis->setVisible(visible); |
|
297 | m_axis->setVisible(visible); | |
298 | QCOMPARE(m_axis->isVisible(), visible); |
|
298 | QCOMPARE(m_axis->isVisible(), visible); | |
299 |
|
299 | |||
300 | QCOMPARE(spy0.count(), 0); |
|
300 | QCOMPARE(spy0.count(), 0); | |
301 | QCOMPARE(spy1.count(), 0); |
|
301 | QCOMPARE(spy1.count(), 0); | |
302 | QCOMPARE(spy2.count(), 0); |
|
302 | QCOMPARE(spy2.count(), 0); | |
303 | QCOMPARE(spy3.count(), 0); |
|
303 | QCOMPARE(spy3.count(), 0); | |
304 | QCOMPARE(spy4.count(), 0); |
|
304 | QCOMPARE(spy4.count(), 0); | |
305 | QCOMPARE(spy5.count(), 0); |
|
305 | QCOMPARE(spy5.count(), 0); | |
306 | QCOMPARE(spy6.count(), 0); |
|
306 | QCOMPARE(spy6.count(), 0); | |
307 | QCOMPARE(spy7.count(), 0); |
|
307 | QCOMPARE(spy7.count(), 0); | |
308 | QCOMPARE(spy8.count(), 1); |
|
308 | QCOMPARE(spy8.count(), 1); | |
309 |
|
309 | |||
310 | m_chart->setAxisX(m_axis, m_series); |
|
310 | m_chart->setAxisX(m_axis, m_series); | |
311 | m_view->show(); |
|
311 | m_view->show(); | |
312 | QTest::qWaitForWindowShown(m_view); |
|
312 | QTest::qWaitForWindowShown(m_view); | |
313 | QCOMPARE(m_axis->isVisible(), visible); |
|
313 | QCOMPARE(m_axis->isVisible(), visible); | |
314 | } |
|
314 | } | |
315 |
|
315 | |||
316 | void tst_QAbstractAxis::labelsAngle_data() |
|
316 | void tst_QAbstractAxis::labelsAngle_data() | |
317 | { |
|
317 | { | |
318 | QTest::addColumn<int>("labelsAngle"); |
|
318 | QTest::addColumn<int>("labelsAngle"); | |
319 | QTest::newRow("0") << 0; |
|
319 | QTest::newRow("0") << 0; | |
320 | QTest::newRow("45") << 45; |
|
320 | QTest::newRow("45") << 45; | |
321 | QTest::newRow("90") << 90; |
|
321 | QTest::newRow("90") << 90; | |
322 | } |
|
322 | } | |
323 |
|
323 | |||
324 | void tst_QAbstractAxis::labelsAngle() |
|
324 | void tst_QAbstractAxis::labelsAngle() | |
325 | { |
|
325 | { | |
326 | QFETCH(int, labelsAngle); |
|
326 | QFETCH(int, labelsAngle); | |
327 |
|
327 | |||
328 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
328 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
329 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
329 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
330 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
330 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
331 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
331 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
332 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
332 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
333 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
333 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
334 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
334 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
335 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
335 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
336 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
336 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
337 |
|
337 | |||
338 | m_axis->setLabelsAngle(labelsAngle); |
|
338 | m_axis->setLabelsAngle(labelsAngle); | |
339 | QCOMPARE(m_axis->labelsAngle(), labelsAngle); |
|
339 | QCOMPARE(m_axis->labelsAngle(), labelsAngle); | |
340 |
|
340 | |||
341 | QCOMPARE(spy0.count(), 0); |
|
341 | QCOMPARE(spy0.count(), 0); | |
342 | QCOMPARE(spy1.count(), 0); |
|
342 | QCOMPARE(spy1.count(), 0); | |
343 | QCOMPARE(spy2.count(), 0); |
|
343 | QCOMPARE(spy2.count(), 0); | |
344 | QCOMPARE(spy3.count(), 0); |
|
344 | QCOMPARE(spy3.count(), 0); | |
345 | QCOMPARE(spy4.count(), 0); |
|
345 | QCOMPARE(spy4.count(), 0); | |
346 | QCOMPARE(spy5.count(), 0); |
|
346 | QCOMPARE(spy5.count(), 0); | |
347 | QCOMPARE(spy6.count(), 0); |
|
347 | QCOMPARE(spy6.count(), 0); | |
348 | QCOMPARE(spy7.count(), 0); |
|
348 | QCOMPARE(spy7.count(), 0); | |
349 | QCOMPARE(spy8.count(), 0); |
|
349 | QCOMPARE(spy8.count(), 0); | |
350 |
|
350 | |||
351 | m_chart->setAxisX(m_axis, m_series); |
|
351 | m_chart->setAxisX(m_axis, m_series); | |
352 | m_view->show(); |
|
352 | m_view->show(); | |
353 | QTest::qWaitForWindowShown(m_view); |
|
353 | QTest::qWaitForWindowShown(m_view); | |
354 | QCOMPARE(m_axis->labelsAngle(), labelsAngle); |
|
354 | QCOMPARE(m_axis->labelsAngle(), labelsAngle); | |
355 | } |
|
355 | } | |
356 |
|
356 | |||
357 | void tst_QAbstractAxis::labelsBrush_data() |
|
357 | void tst_QAbstractAxis::labelsBrush_data() | |
358 | { |
|
358 | { | |
359 | QTest::addColumn<QBrush>("labelsBrush"); |
|
359 | QTest::addColumn<QBrush>("labelsBrush"); | |
360 | QTest::newRow("null") << QBrush(); |
|
360 | QTest::newRow("null") << QBrush(); | |
361 | QTest::newRow("blue") << QBrush(Qt::blue); |
|
361 | QTest::newRow("blue") << QBrush(Qt::blue); | |
362 | QTest::newRow("black") << QBrush(Qt::black); |
|
362 | QTest::newRow("black") << QBrush(Qt::black); | |
363 |
|
363 | |||
364 | } |
|
364 | } | |
365 |
|
365 | |||
366 | void tst_QAbstractAxis::labelsBrush() |
|
366 | void tst_QAbstractAxis::labelsBrush() | |
367 | { |
|
367 | { | |
368 |
|
368 | |||
369 | QFETCH(QBrush, labelsBrush); |
|
369 | QFETCH(QBrush, labelsBrush); | |
370 |
|
370 | |||
371 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
371 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
372 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
372 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
373 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
373 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
374 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
374 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
375 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
375 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
376 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
376 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
377 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
377 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
378 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
378 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
379 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
379 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
380 |
|
380 | |||
381 | m_axis->setLabelsBrush(labelsBrush); |
|
381 | m_axis->setLabelsBrush(labelsBrush); | |
382 | QCOMPARE(m_axis->labelsBrush(), labelsBrush); |
|
382 | QCOMPARE(m_axis->labelsBrush(), labelsBrush); | |
383 |
|
383 | |||
384 | QCOMPARE(spy0.count(), 0); |
|
384 | QCOMPARE(spy0.count(), 0); | |
385 | QCOMPARE(spy1.count(), 0); |
|
385 | QCOMPARE(spy1.count(), 0); | |
386 | QCOMPARE(spy2.count(), 0); |
|
386 | QCOMPARE(spy2.count(), 0); | |
387 | QCOMPARE(spy3.count(), 0); |
|
387 | QCOMPARE(spy3.count(), 0); | |
388 | QCOMPARE(spy4.count(), 0); |
|
388 | QCOMPARE(spy4.count(), 0); | |
389 | QCOMPARE(spy5.count(), 0); |
|
389 | QCOMPARE(spy5.count(), 0); | |
390 | //TODO QCOMPARE(spy6.count(), 0); |
|
390 | //TODO QCOMPARE(spy6.count(), 0); | |
391 | QCOMPARE(spy7.count(), 0); |
|
391 | QCOMPARE(spy7.count(), 0); | |
392 | QCOMPARE(spy8.count(), 0); |
|
392 | QCOMPARE(spy8.count(), 0); | |
393 |
|
393 | |||
394 | m_view->show(); |
|
394 | m_view->show(); | |
395 | QTest::qWaitForWindowShown(m_view); |
|
395 | QTest::qWaitForWindowShown(m_view); | |
396 | QCOMPARE(m_axis->labelsBrush(), labelsBrush); |
|
396 | QCOMPARE(m_axis->labelsBrush(), labelsBrush); | |
397 |
|
397 | |||
398 | } |
|
398 | } | |
399 |
|
399 | |||
400 | void tst_QAbstractAxis::labelsColor_data() |
|
400 | void tst_QAbstractAxis::labelsColor_data() | |
401 | { |
|
401 | { | |
402 |
|
402 | |||
403 | } |
|
403 | } | |
404 |
|
404 | |||
405 | void tst_QAbstractAxis::labelsColor() |
|
405 | void tst_QAbstractAxis::labelsColor() | |
406 | { |
|
406 | { | |
407 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); |
|
407 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); | |
408 | } |
|
408 | } | |
409 |
|
409 | |||
410 | void tst_QAbstractAxis::labelsFont_data() |
|
410 | void tst_QAbstractAxis::labelsFont_data() | |
411 | { |
|
411 | { | |
412 | QTest::addColumn<QFont>("labelsFont"); |
|
412 | QTest::addColumn<QFont>("labelsFont"); | |
413 | QTest::newRow("null") << QFont(); |
|
413 | QTest::newRow("null") << QFont(); | |
414 | QTest::newRow("serif") << QFont("SansSerif"); |
|
414 | QTest::newRow("serif") << QFont("SansSerif"); | |
415 | } |
|
415 | } | |
416 |
|
416 | |||
417 | void tst_QAbstractAxis::labelsFont() |
|
417 | void tst_QAbstractAxis::labelsFont() | |
418 | { |
|
418 | { | |
419 |
|
419 | |||
420 | QFETCH(QFont, labelsFont); |
|
420 | QFETCH(QFont, labelsFont); | |
421 |
|
421 | |||
422 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
422 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
423 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
423 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
424 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
424 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
425 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
425 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
426 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
426 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
427 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
427 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
428 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
428 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
429 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
429 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
430 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
430 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
431 |
|
431 | |||
432 | m_axis->setLabelsFont(labelsFont); |
|
432 | m_axis->setLabelsFont(labelsFont); | |
433 | QCOMPARE(m_axis->labelsFont(), labelsFont); |
|
433 | QCOMPARE(m_axis->labelsFont(), labelsFont); | |
434 |
|
434 | |||
435 | QCOMPARE(spy0.count(), 0); |
|
435 | QCOMPARE(spy0.count(), 0); | |
436 | QCOMPARE(spy1.count(), 0); |
|
436 | QCOMPARE(spy1.count(), 0); | |
437 | QCOMPARE(spy2.count(), 0); |
|
437 | QCOMPARE(spy2.count(), 0); | |
438 | QCOMPARE(spy3.count(), 0); |
|
438 | QCOMPARE(spy3.count(), 0); | |
439 | QCOMPARE(spy4.count(), 0); |
|
439 | QCOMPARE(spy4.count(), 0); | |
440 | QCOMPARE(spy5.count(), 0); |
|
440 | QCOMPARE(spy5.count(), 0); | |
441 | QCOMPARE(spy6.count(), 0); |
|
441 | QCOMPARE(spy6.count(), 0); | |
442 | QCOMPARE(spy7.count(), 0); |
|
442 | QCOMPARE(spy7.count(), 0); | |
443 | QCOMPARE(spy8.count(), 0); |
|
443 | QCOMPARE(spy8.count(), 0); | |
444 |
|
444 | |||
445 | m_view->show(); |
|
445 | m_view->show(); | |
446 | QTest::qWaitForWindowShown(m_view); |
|
446 | QTest::qWaitForWindowShown(m_view); | |
447 | QCOMPARE(m_axis->labelsFont(), labelsFont); |
|
447 | QCOMPARE(m_axis->labelsFont(), labelsFont); | |
448 |
|
448 | |||
449 | } |
|
449 | } | |
450 |
|
450 | |||
451 | void tst_QAbstractAxis::labelsPen_data() |
|
451 | void tst_QAbstractAxis::labelsPen_data() | |
452 | { |
|
452 | { | |
453 | QTest::addColumn<QPen>("labelsPen"); |
|
453 | QTest::addColumn<QPen>("labelsPen"); | |
454 | QTest::newRow("null") << QPen(); |
|
454 | QTest::newRow("null") << QPen(); | |
455 | QTest::newRow("blue") << QPen(Qt::blue); |
|
455 | QTest::newRow("blue") << QPen(Qt::blue); | |
456 | QTest::newRow("black") << QPen(Qt::black); |
|
456 | QTest::newRow("black") << QPen(Qt::black); | |
457 | QTest::newRow("red") << QPen(Qt::red); |
|
457 | QTest::newRow("red") << QPen(Qt::red); | |
458 | } |
|
458 | } | |
459 |
|
459 | |||
460 | void tst_QAbstractAxis::labelsPen() |
|
460 | void tst_QAbstractAxis::labelsPen() | |
461 | { |
|
461 | { | |
462 | QFETCH(QPen, labelsPen); |
|
462 | QFETCH(QPen, labelsPen); | |
463 |
|
463 | |||
464 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
464 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
465 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
465 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
466 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
466 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
467 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
467 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
468 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
468 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
469 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
469 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
470 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
470 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
471 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
471 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
472 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
472 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
473 |
|
473 | |||
474 | m_axis->setLabelsPen(labelsPen); |
|
474 | m_axis->setLabelsPen(labelsPen); | |
475 | QCOMPARE(m_axis->labelsPen(), labelsPen); |
|
475 | QCOMPARE(m_axis->labelsPen(), labelsPen); | |
476 |
|
476 | |||
477 | QCOMPARE(spy0.count(), 0); |
|
477 | QCOMPARE(spy0.count(), 0); | |
478 | QCOMPARE(spy1.count(), 0); |
|
478 | QCOMPARE(spy1.count(), 0); | |
479 | QCOMPARE(spy2.count(), 0); |
|
479 | QCOMPARE(spy2.count(), 0); | |
480 | QCOMPARE(spy3.count(), 0); |
|
480 | QCOMPARE(spy3.count(), 0); | |
481 | QCOMPARE(spy4.count(), 0); |
|
481 | QCOMPARE(spy4.count(), 0); | |
482 | QCOMPARE(spy5.count(), 0); |
|
482 | QCOMPARE(spy5.count(), 0); | |
483 | QCOMPARE(spy6.count(), 0); |
|
483 | QCOMPARE(spy6.count(), 0); | |
484 | QCOMPARE(spy7.count(), 0); |
|
484 | QCOMPARE(spy7.count(), 0); | |
485 | QCOMPARE(spy8.count(), 0); |
|
485 | QCOMPARE(spy8.count(), 0); | |
486 |
|
486 | |||
487 | m_chart->setAxisX(m_axis, m_series); |
|
487 | m_chart->setAxisX(m_axis, m_series); | |
488 | m_view->show(); |
|
488 | m_view->show(); | |
489 | QTest::qWaitForWindowShown(m_view); |
|
489 | QTest::qWaitForWindowShown(m_view); | |
490 | //TODO QCOMPARE(m_axis->labelsPen(), labelsPen); |
|
490 | //TODO QCOMPARE(m_axis->labelsPen(), labelsPen); | |
491 | } |
|
491 | } | |
492 |
|
492 | |||
493 | void tst_QAbstractAxis::labelsVisible_data() |
|
493 | void tst_QAbstractAxis::labelsVisible_data() | |
494 | { |
|
494 | { | |
495 | QTest::addColumn<bool>("labelsVisible"); |
|
495 | QTest::addColumn<bool>("labelsVisible"); | |
496 | QTest::newRow("true") << true; |
|
496 | QTest::newRow("true") << true; | |
497 | QTest::newRow("false") << false; |
|
497 | QTest::newRow("false") << false; | |
498 | } |
|
498 | } | |
499 |
|
499 | |||
500 | void tst_QAbstractAxis::labelsVisible() |
|
500 | void tst_QAbstractAxis::labelsVisible() | |
501 | { |
|
501 | { | |
502 | QFETCH(bool, labelsVisible); |
|
502 | QFETCH(bool, labelsVisible); | |
503 |
|
503 | |||
504 | m_axis->setLabelsVisible(!labelsVisible); |
|
504 | m_axis->setLabelsVisible(!labelsVisible); | |
505 |
|
505 | |||
506 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
506 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
507 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
507 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
508 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
508 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
509 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
509 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
510 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
510 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
511 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
511 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
512 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
512 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
513 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
513 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
514 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
514 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
515 |
|
515 | |||
516 | m_axis->setLabelsVisible(labelsVisible); |
|
516 | m_axis->setLabelsVisible(labelsVisible); | |
517 | QCOMPARE(m_axis->labelsVisible(), labelsVisible); |
|
517 | QCOMPARE(m_axis->labelsVisible(), labelsVisible); | |
518 |
|
518 | |||
519 | QCOMPARE(spy0.count(), 0); |
|
519 | QCOMPARE(spy0.count(), 0); | |
520 | QCOMPARE(spy1.count(), 0); |
|
520 | QCOMPARE(spy1.count(), 0); | |
521 | QCOMPARE(spy2.count(), 0); |
|
521 | QCOMPARE(spy2.count(), 0); | |
522 | QCOMPARE(spy3.count(), 0); |
|
522 | QCOMPARE(spy3.count(), 0); | |
523 | QCOMPARE(spy4.count(), 1); |
|
523 | QCOMPARE(spy4.count(), 1); | |
524 | QCOMPARE(spy5.count(), 0); |
|
524 | QCOMPARE(spy5.count(), 0); | |
525 | QCOMPARE(spy6.count(), 0); |
|
525 | QCOMPARE(spy6.count(), 0); | |
526 | QCOMPARE(spy7.count(), 0); |
|
526 | QCOMPARE(spy7.count(), 0); | |
527 | QCOMPARE(spy8.count(), 0); |
|
527 | QCOMPARE(spy8.count(), 0); | |
528 |
|
528 | |||
529 | m_chart->setAxisX(m_axis, m_series); |
|
529 | m_chart->setAxisX(m_axis, m_series); | |
530 | m_view->show(); |
|
530 | m_view->show(); | |
531 | QTest::qWaitForWindowShown(m_view); |
|
531 | QTest::qWaitForWindowShown(m_view); | |
532 | QCOMPARE(m_axis->labelsVisible(), labelsVisible); |
|
532 | QCOMPARE(m_axis->labelsVisible(), labelsVisible); | |
533 | } |
|
533 | } | |
534 |
|
534 | |||
535 | void tst_QAbstractAxis::orientation_data() |
|
535 | void tst_QAbstractAxis::orientation_data() | |
536 | { |
|
536 | { | |
537 | QTest::addColumn<Qt::Orientation>("orientation"); |
|
537 | QTest::addColumn<Qt::Orientation>("orientation"); | |
538 | QTest::newRow("Vertical") << Qt::Vertical; |
|
538 | QTest::newRow("Vertical") << Qt::Vertical; | |
539 | QTest::newRow("Horizontal") << Qt::Horizontal; |
|
539 | QTest::newRow("Horizontal") << Qt::Horizontal; | |
540 | } |
|
540 | } | |
541 |
|
541 | |||
542 | void tst_QAbstractAxis::orientation() |
|
542 | void tst_QAbstractAxis::orientation() | |
543 | { |
|
543 | { | |
544 | QFETCH(Qt::Orientation, orientation); |
|
544 | QFETCH(Qt::Orientation, orientation); | |
545 |
|
545 | |||
546 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
546 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
547 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
547 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
548 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
548 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
549 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
549 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
550 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
550 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
551 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
551 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
552 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
552 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
553 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
553 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
554 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
554 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
555 |
|
555 | |||
556 | if(orientation==Qt::Vertical){ |
|
556 | if(orientation==Qt::Vertical){ | |
557 | m_chart->setAxisY(m_axis,m_series); |
|
557 | m_chart->setAxisY(m_axis,m_series); | |
558 | }else{ |
|
558 | }else{ | |
559 | m_chart->setAxisX(m_axis,m_series); |
|
559 | m_chart->setAxisX(m_axis,m_series); | |
560 | } |
|
560 | } | |
561 | QCOMPARE(m_axis->orientation(), orientation); |
|
561 | QCOMPARE(m_axis->orientation(), orientation); | |
562 |
|
562 | |||
563 | QCOMPARE(spy0.count(), 0); |
|
563 | QCOMPARE(spy0.count(), 0); | |
564 | QCOMPARE(spy1.count(), 0); |
|
564 | QCOMPARE(spy1.count(), 0); | |
565 | QCOMPARE(spy2.count(), 0); |
|
565 | QCOMPARE(spy2.count(), 0); | |
566 | QCOMPARE(spy3.count(), 0); |
|
566 | QCOMPARE(spy3.count(), 0); | |
567 | QCOMPARE(spy4.count(), 0); |
|
567 | QCOMPARE(spy4.count(), 0); | |
568 | QCOMPARE(spy5.count(), 0); |
|
568 | QCOMPARE(spy5.count(), 0); | |
569 | QCOMPARE(spy6.count(), 0); |
|
569 | QCOMPARE(spy6.count(), 0); | |
570 | QCOMPARE(spy7.count(), 0); |
|
570 | QCOMPARE(spy7.count(), 0); | |
571 | QCOMPARE(spy8.count(), 1); |
|
571 | QCOMPARE(spy8.count(), 1); | |
572 |
|
572 | |||
573 | m_view->show(); |
|
573 | m_view->show(); | |
574 | QTest::qWaitForWindowShown(m_view); |
|
574 | QTest::qWaitForWindowShown(m_view); | |
575 | QCOMPARE(m_axis->orientation(), orientation); |
|
575 | QCOMPARE(m_axis->orientation(), orientation); | |
576 | } |
|
576 | } | |
577 |
|
577 | |||
578 | void tst_QAbstractAxis::setMax_data() |
|
578 | void tst_QAbstractAxis::setMax_data() | |
579 | { |
|
579 | { | |
580 | //just check if it does not crash |
|
580 | //just check if it does not crash | |
581 | QTest::addColumn<QVariant>("max"); |
|
581 | QTest::addColumn<QVariant>("max"); | |
582 | QTest::newRow("something") << QVariant("something"); |
|
582 | QTest::newRow("something") << QVariant("something"); | |
583 | QTest::newRow("1.0") << QVariant(1.0); |
|
583 | QTest::newRow("1.0") << QVariant(1.0); | |
584 | } |
|
584 | } | |
585 |
|
585 | |||
586 | void tst_QAbstractAxis::setMax() |
|
586 | void tst_QAbstractAxis::setMax() | |
587 | { |
|
587 | { | |
588 | QFETCH(QVariant, max); |
|
588 | QFETCH(QVariant, max); | |
589 | m_axis->setMax(max); |
|
589 | m_axis->setMax(max); | |
590 | } |
|
590 | } | |
591 |
|
591 | |||
592 | void tst_QAbstractAxis::setMin_data() |
|
592 | void tst_QAbstractAxis::setMin_data() | |
593 | { |
|
593 | { | |
594 | //just check if it does not crash |
|
594 | //just check if it does not crash | |
595 | QTest::addColumn<QVariant>("min"); |
|
595 | QTest::addColumn<QVariant>("min"); | |
596 | QTest::newRow("something") << QVariant("something"); |
|
596 | QTest::newRow("something") << QVariant("something"); | |
597 | QTest::newRow("1.0") << QVariant(1.0); |
|
597 | QTest::newRow("1.0") << QVariant(1.0); | |
598 | } |
|
598 | } | |
599 |
|
599 | |||
600 | // public void setMin(QVariant const& min) |
|
600 | // public void setMin(QVariant const& min) | |
601 | void tst_QAbstractAxis::setMin() |
|
601 | void tst_QAbstractAxis::setMin() | |
602 | { |
|
602 | { | |
603 | QFETCH(QVariant, min); |
|
603 | QFETCH(QVariant, min); | |
604 | m_axis->setMin(min); |
|
604 | m_axis->setMin(min); | |
605 | } |
|
605 | } | |
606 |
|
606 | |||
607 | void tst_QAbstractAxis::setRange_data() |
|
607 | void tst_QAbstractAxis::setRange_data() | |
608 | { |
|
608 | { | |
609 | //just check if it does not crash |
|
609 | //just check if it does not crash | |
610 | QTest::addColumn<QVariant>("min"); |
|
610 | QTest::addColumn<QVariant>("min"); | |
611 | QTest::addColumn<QVariant>("max"); |
|
611 | QTest::addColumn<QVariant>("max"); | |
612 | QTest::newRow("something") << QVariant("something0") << QVariant("something1"); |
|
612 | QTest::newRow("something") << QVariant("something0") << QVariant("something1"); | |
613 | QTest::newRow("-1 1") << QVariant(-1.0) << QVariant(1.0); |
|
613 | QTest::newRow("-1 1") << QVariant(-1.0) << QVariant(1.0); | |
614 | } |
|
614 | } | |
615 |
|
615 | |||
616 | // public void setRange(QVariant const& min, QVariant const& max) |
|
616 | // public void setRange(QVariant const& min, QVariant const& max) | |
617 | void tst_QAbstractAxis::setRange() |
|
617 | void tst_QAbstractAxis::setRange() | |
618 | { |
|
618 | { | |
619 |
|
619 | |||
620 | QFETCH(QVariant, min); |
|
620 | QFETCH(QVariant, min); | |
621 | QFETCH(QVariant, max); |
|
621 | QFETCH(QVariant, max); | |
622 | m_axis->setRange(min,max); |
|
622 | m_axis->setRange(min,max); | |
623 | } |
|
623 | } | |
624 |
|
624 | |||
625 | void tst_QAbstractAxis::shadesBorderColor_data() |
|
625 | void tst_QAbstractAxis::shadesBorderColor_data() | |
626 | { |
|
626 | { | |
627 |
|
627 | |||
628 | } |
|
628 | } | |
629 |
|
629 | |||
630 | void tst_QAbstractAxis::shadesBorderColor() |
|
630 | void tst_QAbstractAxis::shadesBorderColor() | |
631 | { |
|
631 | { | |
632 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); |
|
632 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); | |
633 | } |
|
633 | } | |
634 |
|
634 | |||
635 | void tst_QAbstractAxis::shadesBrush_data() |
|
635 | void tst_QAbstractAxis::shadesBrush_data() | |
636 | { |
|
636 | { | |
637 | QTest::addColumn<QBrush>("shadesBrush"); |
|
637 | QTest::addColumn<QBrush>("shadesBrush"); | |
638 | QTest::newRow("null") << QBrush(); |
|
638 | QTest::newRow("null") << QBrush(); | |
639 | QTest::newRow("blue") << QBrush(Qt::blue); |
|
639 | QTest::newRow("blue") << QBrush(Qt::blue); | |
640 | QTest::newRow("black") << QBrush(Qt::black); |
|
640 | QTest::newRow("black") << QBrush(Qt::black); | |
641 | } |
|
641 | } | |
642 |
|
642 | |||
643 | void tst_QAbstractAxis::shadesBrush() |
|
643 | void tst_QAbstractAxis::shadesBrush() | |
644 | { |
|
644 | { | |
645 | QFETCH(QBrush, shadesBrush); |
|
645 | QFETCH(QBrush, shadesBrush); | |
646 |
|
646 | |||
647 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
647 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
648 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
648 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
649 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
649 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
650 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
650 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
651 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
651 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
652 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
652 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
653 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
653 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
654 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
654 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
655 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
655 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
656 |
|
656 | |||
657 | m_axis->setShadesBrush(shadesBrush); |
|
657 | m_axis->setShadesBrush(shadesBrush); | |
658 | QCOMPARE(m_axis->shadesBrush(), shadesBrush); |
|
658 | QCOMPARE(m_axis->shadesBrush(), shadesBrush); | |
659 |
|
659 | |||
660 | QCOMPARE(spy0.count(), 0); |
|
660 | QCOMPARE(spy0.count(), 0); | |
661 | QCOMPARE(spy1.count(), 0); |
|
661 | QCOMPARE(spy1.count(), 0); | |
662 | QCOMPARE(spy2.count(), 0); |
|
662 | QCOMPARE(spy2.count(), 0); | |
663 | QCOMPARE(spy3.count(), 0); |
|
663 | QCOMPARE(spy3.count(), 0); | |
664 | QCOMPARE(spy4.count(), 0); |
|
664 | QCOMPARE(spy4.count(), 0); | |
665 | QCOMPARE(spy5.count(), 0); |
|
665 | QCOMPARE(spy5.count(), 0); | |
666 | //TODO QCOMPARE(spy6.count(), 0); |
|
666 | //TODO QCOMPARE(spy6.count(), 0); | |
667 | QCOMPARE(spy7.count(), 0); |
|
667 | QCOMPARE(spy7.count(), 0); | |
668 | QCOMPARE(spy8.count(), 0); |
|
668 | QCOMPARE(spy8.count(), 0); | |
669 |
|
669 | |||
670 | m_view->show(); |
|
670 | m_view->show(); | |
671 | QTest::qWaitForWindowShown(m_view); |
|
671 | QTest::qWaitForWindowShown(m_view); | |
672 | QCOMPARE(m_axis->shadesBrush(), shadesBrush); |
|
672 | QCOMPARE(m_axis->shadesBrush(), shadesBrush); | |
673 | } |
|
673 | } | |
674 |
|
674 | |||
675 | void tst_QAbstractAxis::shadesColor_data() |
|
675 | void tst_QAbstractAxis::shadesColor_data() | |
676 | { |
|
676 | { | |
677 | } |
|
677 | } | |
678 |
|
678 | |||
679 | // public QColor shadesColor() const |
|
679 | // public QColor shadesColor() const | |
680 | void tst_QAbstractAxis::shadesColor() |
|
680 | void tst_QAbstractAxis::shadesColor() | |
681 | { |
|
681 | { | |
682 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); |
|
682 | QSKIP("Test is not implemented. This is deprecated function", SkipAll); | |
683 | } |
|
683 | } | |
684 |
|
684 | |||
685 | void tst_QAbstractAxis::shadesPen_data() |
|
685 | void tst_QAbstractAxis::shadesPen_data() | |
686 | { |
|
686 | { | |
687 | QTest::addColumn<QPen>("shadesPen"); |
|
687 | QTest::addColumn<QPen>("shadesPen"); | |
688 | QTest::newRow("null") << QPen(); |
|
688 | QTest::newRow("null") << QPen(); | |
689 | QTest::newRow("blue") << QPen(Qt::blue); |
|
689 | QTest::newRow("blue") << QPen(Qt::blue); | |
690 | QTest::newRow("black") << QPen(Qt::black); |
|
690 | QTest::newRow("black") << QPen(Qt::black); | |
691 | QTest::newRow("red") << QPen(Qt::red); |
|
691 | QTest::newRow("red") << QPen(Qt::red); | |
692 | } |
|
692 | } | |
693 |
|
693 | |||
694 | void tst_QAbstractAxis::shadesPen() |
|
694 | void tst_QAbstractAxis::shadesPen() | |
695 | { |
|
695 | { | |
696 | QFETCH(QPen, shadesPen); |
|
696 | QFETCH(QPen, shadesPen); | |
697 |
|
697 | |||
698 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
698 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
699 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
699 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
700 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
700 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
701 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
701 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
702 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
702 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
703 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
703 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
704 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
704 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
705 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
705 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
706 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
706 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
707 |
|
707 | |||
708 | m_axis->setShadesPen(shadesPen); |
|
708 | m_axis->setShadesPen(shadesPen); | |
709 | QCOMPARE(m_axis->shadesPen(), shadesPen); |
|
709 | QCOMPARE(m_axis->shadesPen(), shadesPen); | |
710 |
|
710 | |||
711 | QCOMPARE(spy0.count(), 0); |
|
711 | QCOMPARE(spy0.count(), 0); | |
712 | QCOMPARE(spy1.count(), 0); |
|
712 | QCOMPARE(spy1.count(), 0); | |
713 | QCOMPARE(spy2.count(), 0); |
|
713 | QCOMPARE(spy2.count(), 0); | |
714 | QCOMPARE(spy3.count(), 0); |
|
714 | QCOMPARE(spy3.count(), 0); | |
715 | QCOMPARE(spy4.count(), 0); |
|
715 | QCOMPARE(spy4.count(), 0); | |
716 | QCOMPARE(spy5.count(), 0); |
|
716 | QCOMPARE(spy5.count(), 0); | |
717 | QCOMPARE(spy6.count(), 0); |
|
717 | QCOMPARE(spy6.count(), 0); | |
718 | QCOMPARE(spy7.count(), 0); |
|
718 | QCOMPARE(spy7.count(), 0); | |
719 | QCOMPARE(spy8.count(), 0); |
|
719 | QCOMPARE(spy8.count(), 0); | |
720 |
|
720 | |||
721 | m_chart->setAxisX(m_axis, m_series); |
|
721 | m_chart->setAxisX(m_axis, m_series); | |
722 | m_view->show(); |
|
722 | m_view->show(); | |
723 | QTest::qWaitForWindowShown(m_view); |
|
723 | QTest::qWaitForWindowShown(m_view); | |
724 | QCOMPARE(m_axis->shadesPen(), shadesPen); |
|
724 | QCOMPARE(m_axis->shadesPen(), shadesPen); | |
725 | } |
|
725 | } | |
726 |
|
726 | |||
727 | void tst_QAbstractAxis::shadesVisible_data() |
|
727 | void tst_QAbstractAxis::shadesVisible_data() | |
728 | { |
|
728 | { | |
729 | QTest::addColumn<bool>("shadesVisible"); |
|
729 | QTest::addColumn<bool>("shadesVisible"); | |
730 | QTest::newRow("true") << true; |
|
730 | QTest::newRow("true") << true; | |
731 | QTest::newRow("false") << false; |
|
731 | QTest::newRow("false") << false; | |
732 | } |
|
732 | } | |
733 |
|
733 | |||
734 | void tst_QAbstractAxis::shadesVisible() |
|
734 | void tst_QAbstractAxis::shadesVisible() | |
735 | { |
|
735 | { | |
736 | QFETCH(bool, shadesVisible); |
|
736 | QFETCH(bool, shadesVisible); | |
737 |
|
737 | |||
738 | m_axis->setShadesVisible(!shadesVisible); |
|
738 | m_axis->setShadesVisible(!shadesVisible); | |
739 |
|
739 | |||
740 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
740 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
741 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
741 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
742 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
742 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
743 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
743 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
744 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
744 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
745 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
745 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
746 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
746 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
747 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
747 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
748 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
748 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
749 |
|
749 | |||
750 | m_axis->setShadesVisible(shadesVisible); |
|
750 | m_axis->setShadesVisible(shadesVisible); | |
751 | QCOMPARE(m_axis->shadesVisible(), shadesVisible); |
|
751 | QCOMPARE(m_axis->shadesVisible(), shadesVisible); | |
752 |
|
752 | |||
753 | QCOMPARE(spy0.count(), 0); |
|
753 | QCOMPARE(spy0.count(), 0); | |
754 | QCOMPARE(spy1.count(), 0); |
|
754 | QCOMPARE(spy1.count(), 0); | |
755 | QCOMPARE(spy2.count(), 0); |
|
755 | QCOMPARE(spy2.count(), 0); | |
756 | QCOMPARE(spy3.count(), 0); |
|
756 | QCOMPARE(spy3.count(), 0); | |
757 | QCOMPARE(spy4.count(), 0); |
|
757 | QCOMPARE(spy4.count(), 0); | |
758 | QCOMPARE(spy5.count(), 0); |
|
758 | QCOMPARE(spy5.count(), 0); | |
759 | QCOMPARE(spy6.count(), 0); |
|
759 | QCOMPARE(spy6.count(), 0); | |
760 | QCOMPARE(spy7.count(), 1); |
|
760 | QCOMPARE(spy7.count(), 1); | |
761 | QCOMPARE(spy8.count(), 0); |
|
761 | QCOMPARE(spy8.count(), 0); | |
762 |
|
762 | |||
763 | m_chart->setAxisX(m_axis, m_series); |
|
763 | m_chart->setAxisX(m_axis, m_series); | |
764 | m_view->show(); |
|
764 | m_view->show(); | |
765 | QTest::qWaitForWindowShown(m_view); |
|
765 | QTest::qWaitForWindowShown(m_view); | |
766 | QCOMPARE(m_axis->shadesVisible(), shadesVisible); |
|
766 | QCOMPARE(m_axis->shadesVisible(), shadesVisible); | |
767 | } |
|
767 | } | |
768 |
|
768 | |||
769 | void tst_QAbstractAxis::show_data() |
|
769 | void tst_QAbstractAxis::show_data() | |
770 | { |
|
770 | { | |
771 |
|
771 | |||
772 | } |
|
772 | } | |
773 |
|
773 | |||
774 | void tst_QAbstractAxis::show() |
|
774 | void tst_QAbstractAxis::show() | |
775 | { |
|
775 | { | |
776 | m_axis->hide(); |
|
776 | m_axis->hide(); | |
777 | QCOMPARE(m_axis->isVisible(), false); |
|
777 | QCOMPARE(m_axis->isVisible(), false); | |
778 |
|
778 | |||
779 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
779 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
780 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
780 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
781 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
781 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
782 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
782 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
783 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
783 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
784 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
784 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
785 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
785 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
786 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
786 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
787 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
787 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
788 |
|
788 | |||
789 | m_axis->show(); |
|
789 | m_axis->show(); | |
790 |
|
790 | |||
791 | QCOMPARE(spy0.count(), 0); |
|
791 | QCOMPARE(spy0.count(), 0); | |
792 | QCOMPARE(spy1.count(), 0); |
|
792 | QCOMPARE(spy1.count(), 0); | |
793 | QCOMPARE(spy2.count(), 0); |
|
793 | QCOMPARE(spy2.count(), 0); | |
794 | QCOMPARE(spy3.count(), 0); |
|
794 | QCOMPARE(spy3.count(), 0); | |
795 | QCOMPARE(spy4.count(), 0); |
|
795 | QCOMPARE(spy4.count(), 0); | |
796 | QCOMPARE(spy5.count(), 0); |
|
796 | QCOMPARE(spy5.count(), 0); | |
797 | QCOMPARE(spy6.count(), 0); |
|
797 | QCOMPARE(spy6.count(), 0); | |
798 | QCOMPARE(spy7.count(), 0); |
|
798 | QCOMPARE(spy7.count(), 0); | |
799 | QCOMPARE(spy8.count(), 1); |
|
799 | QCOMPARE(spy8.count(), 1); | |
800 | QCOMPARE(m_axis->isVisible(), true); |
|
800 | QCOMPARE(m_axis->isVisible(), true); | |
801 | } |
|
801 | } | |
802 |
|
802 | |||
803 | void tst_QAbstractAxis::hide_data() |
|
803 | void tst_QAbstractAxis::hide_data() | |
804 | { |
|
804 | { | |
805 |
|
805 | |||
806 | } |
|
806 | } | |
807 |
|
807 | |||
808 | void tst_QAbstractAxis::hide() |
|
808 | void tst_QAbstractAxis::hide() | |
809 | { |
|
809 | { | |
810 | m_axis->show(); |
|
810 | m_axis->show(); | |
811 | QCOMPARE(m_axis->isVisible(),true); |
|
811 | QCOMPARE(m_axis->isVisible(),true); | |
812 |
|
812 | |||
813 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); |
|
813 | QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool))); | |
814 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); |
|
814 | QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor))); | |
815 |
QSignalSpy spy2(m_axis, SIGNAL(grid |
|
815 | QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool))); | |
816 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); |
|
816 | QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor))); | |
817 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); |
|
817 | QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool))); | |
818 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); |
|
818 | QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor))); | |
819 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); |
|
819 | QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor))); | |
820 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); |
|
820 | QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool))); | |
821 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); |
|
821 | QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool))); | |
822 |
|
822 | |||
823 | m_axis->hide(); |
|
823 | m_axis->hide(); | |
824 |
|
824 | |||
825 | QCOMPARE(spy0.count(), 0); |
|
825 | QCOMPARE(spy0.count(), 0); | |
826 | QCOMPARE(spy1.count(), 0); |
|
826 | QCOMPARE(spy1.count(), 0); | |
827 | QCOMPARE(spy2.count(), 0); |
|
827 | QCOMPARE(spy2.count(), 0); | |
828 | QCOMPARE(spy3.count(), 0); |
|
828 | QCOMPARE(spy3.count(), 0); | |
829 | QCOMPARE(spy4.count(), 0); |
|
829 | QCOMPARE(spy4.count(), 0); | |
830 | QCOMPARE(spy5.count(), 0); |
|
830 | QCOMPARE(spy5.count(), 0); | |
831 | QCOMPARE(spy6.count(), 0); |
|
831 | QCOMPARE(spy6.count(), 0); | |
832 | QCOMPARE(spy7.count(), 0); |
|
832 | QCOMPARE(spy7.count(), 0); | |
833 | QCOMPARE(spy8.count(), 1); |
|
833 | QCOMPARE(spy8.count(), 1); | |
834 | QCOMPARE(m_axis->isVisible(),false); |
|
834 | QCOMPARE(m_axis->isVisible(),false); | |
835 | } |
|
835 | } | |
836 |
|
836 | |||
837 |
|
837 | |||
838 |
|
838 | |||
839 |
|
839 | |||
840 |
|
840 | |||
841 |
|
841 | |||
842 |
|
842 | |||
843 |
|
843 | |||
844 |
|
844 | |||
845 |
|
845 | |||
846 |
|
846 | |||
847 |
|
847 |
General Comments 0
You need to be logged in to leave comments.
Login now