##// END OF EJS Templates
Added grid color property for value axis...
Titta Heikkala -
r2810:2db41b8cb90b
parent child
Show More
@@ -225,6 +225,26 void CartesianChartAxis::handleMinorGridPenChanged(const QPen &pen)
225 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
225 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
226 }
226 }
227
227
228 void CartesianChartAxis::handleGridLineColorChanged(const QColor &color)
229 {
230 foreach (QGraphicsItem *item, gridItems()) {
231 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem *>(item);
232 QPen pen = lineItem->pen();
233 pen.setColor(color);
234 lineItem->setPen(pen);
235 }
236 }
237
238 void CartesianChartAxis::handleMinorGridLineColorChanged(const QColor &color)
239 {
240 foreach (QGraphicsItem *item, minorGridItems()) {
241 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem *>(item);
242 QPen pen = lineItem->pen();
243 pen.setColor(color);
244 lineItem->setPen(pen);
245 }
246 }
247
228 void CartesianChartAxis::handleShadesBrushChanged(const QBrush &brush)
248 void CartesianChartAxis::handleShadesBrushChanged(const QBrush &brush)
229 {
249 {
230 foreach (QGraphicsItem *item, shadeItems())
250 foreach (QGraphicsItem *item, shadeItems())
@@ -62,6 +62,8 public Q_SLOTS:
62 virtual void handleShadesPenChanged(const QPen &pen);
62 virtual void handleShadesPenChanged(const QPen &pen);
63 virtual void handleMinorArrowPenChanged(const QPen &pen);
63 virtual void handleMinorArrowPenChanged(const QPen &pen);
64 virtual void handleMinorGridPenChanged(const QPen &pen);
64 virtual void handleMinorGridPenChanged(const QPen &pen);
65 virtual void handleGridLineColorChanged(const QColor &color);
66 virtual void handleMinorGridLineColorChanged(const QColor &color);
65
67
66 private:
68 private:
67 void createItems(int count);
69 void createItems(int count);
@@ -106,6 +106,10 void ChartAxisElement::connectSlots()
106 this, SLOT(handleMinorGridVisibleChanged(bool)));
106 this, SLOT(handleMinorGridVisibleChanged(bool)));
107 QObject::connect(axis(), SIGNAL(minorGridLinePenChanged(const QPen&)),
107 QObject::connect(axis(), SIGNAL(minorGridLinePenChanged(const QPen&)),
108 this, SLOT(handleMinorGridPenChanged(const QPen&)));
108 this, SLOT(handleMinorGridPenChanged(const QPen&)));
109 QObject::connect(axis(), SIGNAL(gridLineColorChanged(const QColor&)),
110 this, SLOT(handleGridLineColorChanged(const QColor&)));
111 QObject::connect(axis(), SIGNAL(minorGridLineColorChanged(const QColor&)),
112 this, SLOT(handleMinorGridLineColorChanged(const QColor&)));
109
113
110 if (axis()->type() == QAbstractAxis::AxisTypeCategory) {
114 if (axis()->type() == QAbstractAxis::AxisTypeCategory) {
111 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
115 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
@@ -122,6 +122,8 public Q_SLOTS:
122 virtual void handleGridPenChanged(const QPen &pen) = 0;
122 virtual void handleGridPenChanged(const QPen &pen) = 0;
123 virtual void handleMinorArrowPenChanged(const QPen &pen) = 0;
123 virtual void handleMinorArrowPenChanged(const QPen &pen) = 0;
124 virtual void handleMinorGridPenChanged(const QPen &pen) = 0;
124 virtual void handleMinorGridPenChanged(const QPen &pen) = 0;
125 virtual void handleMinorGridLineColorChanged(const QColor &color) = 0;
126 virtual void handleGridLineColorChanged(const QColor &color) = 0;
125 void handleLabelsBrushChanged(const QBrush &brush);
127 void handleLabelsBrushChanged(const QBrush &brush);
126 void handleLabelsFontChanged(const QFont &font);
128 void handleLabelsFontChanged(const QFont &font);
127 void handleTitleBrushChanged(const QBrush &brush);
129 void handleTitleBrushChanged(const QBrush &brush);
@@ -356,6 +356,26 void PolarChartAxisAngular::handleMinorGridPenChanged(const QPen &pen)
356 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
356 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
357 }
357 }
358
358
359 void PolarChartAxisAngular::handleGridLineColorChanged(const QColor &color)
360 {
361 foreach (QGraphicsItem *item, gridItems()) {
362 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem *>(item);
363 QPen pen = lineItem->pen();
364 pen.setColor(color);
365 lineItem->setPen(pen);
366 }
367 }
368
369 void PolarChartAxisAngular::handleMinorGridLineColorChanged(const QColor &color)
370 {
371 foreach (QGraphicsItem *item, minorGridItems()) {
372 QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem *>(item);
373 QPen pen = lineItem->pen();
374 pen.setColor(color);
375 lineItem->setPen(pen);
376 }
377 }
378
359 QSizeF PolarChartAxisAngular::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
379 QSizeF PolarChartAxisAngular::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
360 {
380 {
361 Q_UNUSED(which);
381 Q_UNUSED(which);
@@ -54,6 +54,8 public Q_SLOTS:
54 virtual void handleGridPenChanged(const QPen &pen);
54 virtual void handleGridPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
57 virtual void handleGridLineColorChanged(const QColor &color);
58 virtual void handleMinorGridLineColorChanged(const QColor &color);
57
59
58 private:
60 private:
59 QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
61 QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
@@ -332,6 +332,26 void PolarChartAxisRadial::handleMinorGridPenChanged(const QPen &pen)
332 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
332 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
333 }
333 }
334
334
335 void PolarChartAxisRadial::handleGridLineColorChanged(const QColor &color)
336 {
337 foreach (QGraphicsItem *item, gridItems()) {
338 QGraphicsEllipseItem *ellipseItem = static_cast<QGraphicsEllipseItem *>(item);
339 QPen pen = ellipseItem->pen();
340 pen.setColor(color);
341 ellipseItem->setPen(pen);
342 }
343 }
344
345 void PolarChartAxisRadial::handleMinorGridLineColorChanged(const QColor &color)
346 {
347 foreach (QGraphicsItem *item, minorGridItems()) {
348 QGraphicsEllipseItem *ellipseItem = static_cast<QGraphicsEllipseItem *>(item);
349 QPen pen = ellipseItem->pen();
350 pen.setColor(color);
351 ellipseItem->setPen(pen);
352 }
353 }
354
335 QSizeF PolarChartAxisRadial::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
355 QSizeF PolarChartAxisRadial::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
336 {
356 {
337 Q_UNUSED(which);
357 Q_UNUSED(which);
@@ -54,6 +54,8 public Q_SLOTS:
54 virtual void handleGridPenChanged(const QPen &pen);
54 virtual void handleGridPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
57 virtual void handleGridLineColorChanged(const QColor &color);
58 virtual void handleMinorGridLineColorChanged(const QColor &color);
57 };
59 };
58
60
59 QT_CHARTS_END_NAMESPACE
61 QT_CHARTS_END_NAMESPACE
@@ -142,6 +142,16 QT_CHARTS_BEGIN_NAMESPACE
142 */
142 */
143
143
144 /*!
144 /*!
145 \property QAbstractAxis::gridLineColor
146 The color of the grid line.
147 */
148
149 /*!
150 \property QAbstractAxis::minorGridLineColor
151 The color of the minor grid line. Applies only to QValueAxis.
152 */
153
154 /*!
145 \property QAbstractAxis::labelsFont
155 \property QAbstractAxis::labelsFont
146 The font of the axis labels.
156 The font of the axis labels.
147 */
157 */
@@ -359,6 +369,16 QT_CHARTS_BEGIN_NAMESPACE
359 */
369 */
360
370
361 /*!
371 /*!
372 \fn void QAbstractAxis::gridLineColorChanged(const QColor &color)
373 The color of the pen of the grid line has changed to \a color.
374 */
375
376 /*!
377 \fn void QAbstractAxis::minorGridLineColorChanged(const QColor &color)
378 The color of the pen of the minor grid line has changed to \a color.
379 */
380
381 /*!
362 \fn void QAbstractAxis::colorChanged(QColor color)
382 \fn void QAbstractAxis::colorChanged(QColor color)
363 Emitted if the \a color of the axis is changed.
383 Emitted if the \a color of the axis is changed.
364 */
384 */
@@ -584,6 +604,36 QPen QAbstractAxis::minorGridLinePen() const
584 return d_ptr->m_minorGridLinePen;
604 return d_ptr->m_minorGridLinePen;
585 }
605 }
586
606
607 void QAbstractAxis::setGridLineColor(const QColor &color)
608 {
609 QPen pen = d_ptr->m_gridLinePen;
610 if (color != pen.color()) {
611 pen.setColor(color);
612 d_ptr->m_gridLinePen = pen;
613 emit gridLineColorChanged(color);
614 }
615 }
616
617 QColor QAbstractAxis::gridLineColor()
618 {
619 return d_ptr->m_gridLinePen.color();
620 }
621
622 void QAbstractAxis::setMinorGridLineColor(const QColor &color)
623 {
624 QPen pen = d_ptr->m_minorGridLinePen;
625 if (color != pen.color()) {
626 pen.setColor(color);
627 d_ptr->m_minorGridLinePen = pen;
628 emit minorGridLineColorChanged(color);
629 }
630 }
631
632 QColor QAbstractAxis::minorGridLineColor()
633 {
634 return d_ptr->m_minorGridLinePen.color();
635 }
636
587 void QAbstractAxis::setLabelsVisible(bool visible)
637 void QAbstractAxis::setLabelsVisible(bool visible)
588 {
638 {
589 if (d_ptr->m_labelsVisible != visible) {
639 if (d_ptr->m_labelsVisible != visible) {
@@ -48,6 +48,8 class QT_CHARTS_EXPORT QAbstractAxis : public QObject
48 Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
48 Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
49 Q_PROPERTY(bool minorGridVisible READ isMinorGridLineVisible WRITE setMinorGridLineVisible NOTIFY minorGridVisibleChanged)
49 Q_PROPERTY(bool minorGridVisible READ isMinorGridLineVisible WRITE setMinorGridLineVisible NOTIFY minorGridVisibleChanged)
50 Q_PROPERTY(QPen minorGridLinePen READ minorGridLinePen WRITE setMinorGridLinePen NOTIFY minorGridLinePenChanged)
50 Q_PROPERTY(QPen minorGridLinePen READ minorGridLinePen WRITE setMinorGridLinePen NOTIFY minorGridLinePenChanged)
51 Q_PROPERTY(QColor gridLineColor READ gridLineColor WRITE setGridLineColor NOTIFY gridLineColorChanged)
52 Q_PROPERTY(QColor minorGridLineColor READ minorGridLineColor WRITE setMinorGridLineColor NOTIFY minorGridLineColorChanged)
51 //shades
53 //shades
52 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
54 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
53 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
55 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
@@ -109,6 +111,10 public:
109 void setMinorGridLineVisible(bool visible = true);
111 void setMinorGridLineVisible(bool visible = true);
110 void setMinorGridLinePen(const QPen &pen);
112 void setMinorGridLinePen(const QPen &pen);
111 QPen minorGridLinePen() const;
113 QPen minorGridLinePen() const;
114 void setGridLineColor(const QColor &color);
115 QColor gridLineColor();
116 void setMinorGridLineColor(const QColor &color);
117 QColor minorGridLineColor();
112
118
113 //labels handling
119 //labels handling
114 bool labelsVisible() const;
120 bool labelsVisible() const;
@@ -168,6 +174,8 Q_SIGNALS:
168 void gridVisibleChanged(bool visible);
174 void gridVisibleChanged(bool visible);
169 void minorGridVisibleChanged(bool visible);
175 void minorGridVisibleChanged(bool visible);
170 void minorGridLinePenChanged(const QPen &pen);
176 void minorGridLinePenChanged(const QPen &pen);
177 void gridLineColorChanged(const QColor &color);
178 void minorGridLineColorChanged(const QColor &color);
171 void colorChanged(QColor color);
179 void colorChanged(QColor color);
172 void labelsColorChanged(QColor color);
180 void labelsColorChanged(QColor color);
173 void titleTextChanged(const QString &title);
181 void titleTextChanged(const QString &title);
@@ -2027,6 +2027,8 Module {
2027 Property { name: "gridLinePen"; type: "QPen" }
2027 Property { name: "gridLinePen"; type: "QPen" }
2028 Property { name: "minorGridVisible"; type: "bool" }
2028 Property { name: "minorGridVisible"; type: "bool" }
2029 Property { name: "minorGridLinePen"; type: "QPen" }
2029 Property { name: "minorGridLinePen"; type: "QPen" }
2030 Property { name: "gridLineColor"; type: "QColor" }
2031 Property { name: "minorGridLineColor"; type: "QColor" }
2030 Property { name: "shadesVisible"; type: "bool" }
2032 Property { name: "shadesVisible"; type: "bool" }
2031 Property { name: "shadesColor"; type: "QColor" }
2033 Property { name: "shadesColor"; type: "QColor" }
2032 Property { name: "shadesBorderColor"; type: "QColor" }
2034 Property { name: "shadesBorderColor"; type: "QColor" }
@@ -2084,6 +2086,14 Module {
2084 Parameter { name: "pen"; type: "QPen" }
2086 Parameter { name: "pen"; type: "QPen" }
2085 }
2087 }
2086 Signal {
2088 Signal {
2089 name: "gridLineColorChanged"
2090 Parameter { name: "color"; type: "QColor" }
2091 }
2092 Signal {
2093 name: "minorGridLineColorChanged"
2094 Parameter { name: "color"; type: "QColor" }
2095 }
2096 Signal {
2087 name: "colorChanged"
2097 name: "colorChanged"
2088 Parameter { name: "color"; type: "QColor" }
2098 Parameter { name: "color"; type: "QColor" }
2089 }
2099 }
@@ -65,6 +65,8 void tst_QAbstractAxis::qabstractaxis()
65 m_axis->setLinePenColor(QColor());
65 m_axis->setLinePenColor(QColor());
66 m_axis->setGridLinePen(QPen());
66 m_axis->setGridLinePen(QPen());
67 m_axis->setGridLineVisible(false);
67 m_axis->setGridLineVisible(false);
68 m_axis->setGridLineColor(QColor());
69 m_axis->setMinorGridLineColor(QColor());
68 m_axis->setLabelsAngle(-1);
70 m_axis->setLabelsAngle(-1);
69 m_axis->setLabelsBrush(QBrush());
71 m_axis->setLabelsBrush(QBrush());
70 m_axis->setLabelsColor(QColor());
72 m_axis->setLabelsColor(QColor());
@@ -111,6 +113,8 void tst_QAbstractAxis::axisPen()
111 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
113 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
112 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
114 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
113 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
115 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
116 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
117 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
114
118
115 m_axis->setLinePen(axisPen);
119 m_axis->setLinePen(axisPen);
116 QCOMPARE(m_axis->linePen(), axisPen);
120 QCOMPARE(m_axis->linePen(), axisPen);
@@ -125,6 +129,8 void tst_QAbstractAxis::axisPen()
125 QCOMPARE(spy7.count(), 0);
129 QCOMPARE(spy7.count(), 0);
126 QCOMPARE(spy8.count(), 0);
130 QCOMPARE(spy8.count(), 0);
127 QCOMPARE(spy9.count(), 0);
131 QCOMPARE(spy9.count(), 0);
132 QCOMPARE(spy10.count(), 0);
133 QCOMPARE(spy11.count(), 0);
128
134
129 m_chart->setAxisX(m_axis, m_series);
135 m_chart->setAxisX(m_axis, m_series);
130 m_view->show();
136 m_view->show();
@@ -165,6 +171,9 void tst_QAbstractAxis::gridLinePen()
165 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
171 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
166 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
172 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
167 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
173 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
174 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
175 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
176 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
168
177
169 m_axis->setGridLinePen(gridLinePen);
178 m_axis->setGridLinePen(gridLinePen);
170 QCOMPARE(m_axis->gridLinePen(), gridLinePen);
179 QCOMPARE(m_axis->gridLinePen(), gridLinePen);
@@ -178,6 +187,9 void tst_QAbstractAxis::gridLinePen()
178 QCOMPARE(spy6.count(), 0);
187 QCOMPARE(spy6.count(), 0);
179 QCOMPARE(spy7.count(), 0);
188 QCOMPARE(spy7.count(), 0);
180 QCOMPARE(spy8.count(), 0);
189 QCOMPARE(spy8.count(), 0);
190 QCOMPARE(spy9.count(), 0);
191 QCOMPARE(spy10.count(), 0);
192 QCOMPARE(spy11.count(), 0);
181
193
182 m_chart->setAxisX(m_axis, m_series);
194 m_chart->setAxisX(m_axis, m_series);
183 m_view->show();
195 m_view->show();
@@ -210,6 +222,8 void tst_QAbstractAxis::minorGridLinePen()
210 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
222 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
211 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
223 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
212 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
224 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
225 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
226 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
213
227
214 m_axis->setMinorGridLinePen(minorGridLinePen);
228 m_axis->setMinorGridLinePen(minorGridLinePen);
215 QCOMPARE(m_axis->minorGridLinePen(), minorGridLinePen);
229 QCOMPARE(m_axis->minorGridLinePen(), minorGridLinePen);
@@ -224,6 +238,8 void tst_QAbstractAxis::minorGridLinePen()
224 QCOMPARE(spy7.count(), 0);
238 QCOMPARE(spy7.count(), 0);
225 QCOMPARE(spy8.count(), 0);
239 QCOMPARE(spy8.count(), 0);
226 QCOMPARE(spy9.count(), 0);
240 QCOMPARE(spy9.count(), 0);
241 QCOMPARE(spy10.count(), 0);
242 QCOMPARE(spy11.count(), 0);
227
243
228 m_chart->setAxisX(m_axis, m_series);
244 m_chart->setAxisX(m_axis, m_series);
229 m_view->show();
245 m_view->show();
@@ -254,6 +270,8 void tst_QAbstractAxis::lineVisible()
254 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
270 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
255 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
271 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
256 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
272 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
273 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
274 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
257
275
258 m_axis->setLineVisible(lineVisible);
276 m_axis->setLineVisible(lineVisible);
259 QCOMPARE(m_axis->isLineVisible(), lineVisible);
277 QCOMPARE(m_axis->isLineVisible(), lineVisible);
@@ -268,6 +286,8 void tst_QAbstractAxis::lineVisible()
268 QCOMPARE(spy7.count(), 0);
286 QCOMPARE(spy7.count(), 0);
269 QCOMPARE(spy8.count(), 0);
287 QCOMPARE(spy8.count(), 0);
270 QCOMPARE(spy9.count(), 0);
288 QCOMPARE(spy9.count(), 0);
289 QCOMPARE(spy10.count(), 0);
290 QCOMPARE(spy11.count(), 0);
271
291
272 m_chart->setAxisX(m_axis, m_series);
292 m_chart->setAxisX(m_axis, m_series);
273 m_view->show();
293 m_view->show();
@@ -297,6 +317,7 void tst_QAbstractAxis::gridLineVisible()
297 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
317 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
298 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
318 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
299 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
319 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
320 QSignalSpy spy9(m_axis, SIGNAL(gridLineColorChanged(QColor)));
300
321
301 m_axis->setGridLineVisible(gridLineVisible);
322 m_axis->setGridLineVisible(gridLineVisible);
302 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
323 QCOMPARE(m_axis->isGridLineVisible(), gridLineVisible);
@@ -310,6 +331,7 void tst_QAbstractAxis::gridLineVisible()
310 QCOMPARE(spy6.count(), 0);
331 QCOMPARE(spy6.count(), 0);
311 QCOMPARE(spy7.count(), 0);
332 QCOMPARE(spy7.count(), 0);
312 QCOMPARE(spy8.count(), 0);
333 QCOMPARE(spy8.count(), 0);
334 QCOMPARE(spy9.count(), 0);
313
335
314 m_chart->setAxisX(m_axis, m_series);
336 m_chart->setAxisX(m_axis, m_series);
315 m_view->show();
337 m_view->show();
@@ -341,6 +363,8 void tst_QAbstractAxis::minorGridLineVisible()
341 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
363 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
342 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
364 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
343 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
365 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
366 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
367 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
344
368
345 m_axis->setMinorGridLineVisible(minorGridLineVisible);
369 m_axis->setMinorGridLineVisible(minorGridLineVisible);
346 QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible);
370 QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible);
@@ -355,6 +379,8 void tst_QAbstractAxis::minorGridLineVisible()
355 QCOMPARE(spy7.count(), 0);
379 QCOMPARE(spy7.count(), 0);
356 QCOMPARE(spy8.count(), 0);
380 QCOMPARE(spy8.count(), 0);
357 QCOMPARE(spy9.count(), 1);
381 QCOMPARE(spy9.count(), 1);
382 QCOMPARE(spy10.count(), 0);
383 QCOMPARE(spy11.count(), 0);
358
384
359 m_chart->setAxisX(m_axis, m_series);
385 m_chart->setAxisX(m_axis, m_series);
360 m_view->show();
386 m_view->show();
@@ -363,6 +389,100 void tst_QAbstractAxis::minorGridLineVisible()
363
389
364 }
390 }
365
391
392 void tst_QAbstractAxis::gridLineColor_data()
393 {
394 QTest::addColumn<QColor>("gridLineColor");
395 QTest::newRow("blue") << QColor(Qt::blue);
396 QTest::newRow("red") << QColor(Qt::red);
397 QTest::newRow("yellow") << QColor(Qt::yellow);
398 }
399
400 void tst_QAbstractAxis::gridLineColor()
401 {
402 QFETCH(QColor, gridLineColor);
403
404 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
405 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
406 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
407 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
408 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
409 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
410 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
411 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
412 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
413 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
414 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
415 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
416
417 m_axis->setGridLineColor(gridLineColor);
418 QCOMPARE(m_axis->gridLineColor(), gridLineColor);
419
420 QCOMPARE(spy0.count(), 0);
421 QCOMPARE(spy1.count(), 0);
422 QCOMPARE(spy2.count(), 0);
423 QCOMPARE(spy3.count(), 0);
424 QCOMPARE(spy4.count(), 0);
425 QCOMPARE(spy5.count(), 0);
426 QCOMPARE(spy6.count(), 0);
427 QCOMPARE(spy7.count(), 0);
428 QCOMPARE(spy8.count(), 0);
429 QCOMPARE(spy9.count(), 0);
430 QCOMPARE(spy10.count(), 1);
431 QCOMPARE(spy11.count(), 0);
432
433 m_chart->setAxisX(m_axis, m_series);
434 m_view->show();
435 QTest::qWaitForWindowShown(m_view);
436
437 }
438
439 void tst_QAbstractAxis::minorGridLineColor_data()
440 {
441 QTest::addColumn<QColor>("minorGridLineColor");
442 QTest::newRow("blue") << QColor(Qt::blue);
443 QTest::newRow("red") << QColor(Qt::red);
444 QTest::newRow("yellow") << QColor(Qt::yellow);
445 }
446
447 void tst_QAbstractAxis::minorGridLineColor()
448 {
449 QFETCH(QColor, minorGridLineColor);
450
451 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
452 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
453 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
454 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
455 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
456 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
457 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
458 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
459 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
460 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
461 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
462 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
463
464 m_axis->setMinorGridLineColor(minorGridLineColor);
465 QCOMPARE(m_axis->minorGridLineColor(), minorGridLineColor);
466
467 QCOMPARE(spy0.count(), 0);
468 QCOMPARE(spy1.count(), 0);
469 QCOMPARE(spy2.count(), 0);
470 QCOMPARE(spy3.count(), 0);
471 QCOMPARE(spy4.count(), 0);
472 QCOMPARE(spy5.count(), 0);
473 QCOMPARE(spy6.count(), 0);
474 QCOMPARE(spy7.count(), 0);
475 QCOMPARE(spy8.count(), 0);
476 QCOMPARE(spy9.count(), 0);
477 QCOMPARE(spy10.count(), 0);
478 QCOMPARE(spy11.count(), 1);
479
480 m_chart->setAxisX(m_axis, m_series);
481 m_view->show();
482 QTest::qWaitForWindowShown(m_view);
483
484 }
485
366 void tst_QAbstractAxis::visible_data()
486 void tst_QAbstractAxis::visible_data()
367 {
487 {
368 QTest::addColumn<bool>("visible");
488 QTest::addColumn<bool>("visible");
@@ -386,6 +506,8 void tst_QAbstractAxis::visible()
386 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
506 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
387 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
507 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
388 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
508 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
509 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
510 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
389
511
390 m_axis->setVisible(visible);
512 m_axis->setVisible(visible);
391 QCOMPARE(m_axis->isVisible(), visible);
513 QCOMPARE(m_axis->isVisible(), visible);
@@ -400,6 +522,8 void tst_QAbstractAxis::visible()
400 QCOMPARE(spy7.count(), 0);
522 QCOMPARE(spy7.count(), 0);
401 QCOMPARE(spy8.count(), 1);
523 QCOMPARE(spy8.count(), 1);
402 QCOMPARE(spy9.count(), 0);
524 QCOMPARE(spy9.count(), 0);
525 QCOMPARE(spy10.count(), 0);
526 QCOMPARE(spy11.count(), 0);
403
527
404 m_chart->setAxisX(m_axis, m_series);
528 m_chart->setAxisX(m_axis, m_series);
405 m_view->show();
529 m_view->show();
@@ -429,6 +553,8 void tst_QAbstractAxis::labelsAngle()
429 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
553 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
430 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
554 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
431 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
555 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
556 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
557 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
432
558
433 m_axis->setLabelsAngle(labelsAngle);
559 m_axis->setLabelsAngle(labelsAngle);
434 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
560 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
@@ -443,6 +569,8 void tst_QAbstractAxis::labelsAngle()
443 QCOMPARE(spy7.count(), 0);
569 QCOMPARE(spy7.count(), 0);
444 QCOMPARE(spy8.count(), 0);
570 QCOMPARE(spy8.count(), 0);
445 QCOMPARE(spy9.count(), 0);
571 QCOMPARE(spy9.count(), 0);
572 QCOMPARE(spy10.count(), 0);
573 QCOMPARE(spy11.count(), 0);
446
574
447 m_chart->setAxisX(m_axis, m_series);
575 m_chart->setAxisX(m_axis, m_series);
448 m_view->show();
576 m_view->show();
@@ -474,6 +602,8 void tst_QAbstractAxis::labelsBrush()
474 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
602 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
475 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
603 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
476 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
604 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
605 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
606 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
477
607
478 m_axis->setLabelsBrush(labelsBrush);
608 m_axis->setLabelsBrush(labelsBrush);
479 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
609 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
@@ -488,6 +618,8 void tst_QAbstractAxis::labelsBrush()
488 QCOMPARE(spy7.count(), 0);
618 QCOMPARE(spy7.count(), 0);
489 QCOMPARE(spy8.count(), 0);
619 QCOMPARE(spy8.count(), 0);
490 QCOMPARE(spy9.count(), 0);
620 QCOMPARE(spy9.count(), 0);
621 QCOMPARE(spy10.count(), 0);
622 QCOMPARE(spy11.count(), 0);
491
623
492 m_view->show();
624 m_view->show();
493 QTest::qWaitForWindowShown(m_view);
625 QTest::qWaitForWindowShown(m_view);
@@ -527,6 +659,8 void tst_QAbstractAxis::labelsFont()
527 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
659 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
528 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
660 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
529 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
661 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
662 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
663 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
530
664
531 m_axis->setLabelsFont(labelsFont);
665 m_axis->setLabelsFont(labelsFont);
532 QCOMPARE(m_axis->labelsFont(), labelsFont);
666 QCOMPARE(m_axis->labelsFont(), labelsFont);
@@ -541,6 +675,8 void tst_QAbstractAxis::labelsFont()
541 QCOMPARE(spy7.count(), 0);
675 QCOMPARE(spy7.count(), 0);
542 QCOMPARE(spy8.count(), 0);
676 QCOMPARE(spy8.count(), 0);
543 QCOMPARE(spy9.count(), 0);
677 QCOMPARE(spy9.count(), 0);
678 QCOMPARE(spy10.count(), 0);
679 QCOMPARE(spy11.count(), 0);
544
680
545 m_view->show();
681 m_view->show();
546 QTest::qWaitForWindowShown(m_view);
682 QTest::qWaitForWindowShown(m_view);
@@ -571,6 +707,8 void tst_QAbstractAxis::labelsVisible()
571 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
707 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
572 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
708 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
573 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
709 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
710 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
711 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
574
712
575 m_axis->setLabelsVisible(labelsVisible);
713 m_axis->setLabelsVisible(labelsVisible);
576 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
714 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
@@ -585,6 +723,8 void tst_QAbstractAxis::labelsVisible()
585 QCOMPARE(spy7.count(), 0);
723 QCOMPARE(spy7.count(), 0);
586 QCOMPARE(spy8.count(), 0);
724 QCOMPARE(spy8.count(), 0);
587 QCOMPARE(spy9.count(), 0);
725 QCOMPARE(spy9.count(), 0);
726 QCOMPARE(spy10.count(), 0);
727 QCOMPARE(spy11.count(), 0);
588
728
589 m_chart->setAxisX(m_axis, m_series);
729 m_chart->setAxisX(m_axis, m_series);
590 m_view->show();
730 m_view->show();
@@ -613,6 +753,8 void tst_QAbstractAxis::orientation()
613 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
753 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
614 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
754 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
615 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
755 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
756 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
757 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
616
758
617 if(orientation==Qt::Vertical){
759 if(orientation==Qt::Vertical){
618 m_chart->setAxisY(m_axis,m_series);
760 m_chart->setAxisY(m_axis,m_series);
@@ -631,6 +773,8 void tst_QAbstractAxis::orientation()
631 QCOMPARE(spy7.count(), 0);
773 QCOMPARE(spy7.count(), 0);
632 QCOMPARE(spy8.count(), 0);
774 QCOMPARE(spy8.count(), 0);
633 QCOMPARE(spy9.count(), 0);
775 QCOMPARE(spy9.count(), 0);
776 QCOMPARE(spy10.count(), 0);
777 QCOMPARE(spy11.count(), 0);
634
778
635 m_view->show();
779 m_view->show();
636 QTest::qWaitForWindowShown(m_view);
780 QTest::qWaitForWindowShown(m_view);
@@ -716,6 +860,8 void tst_QAbstractAxis::shadesBrush()
716 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
860 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
717 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
861 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
718 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
862 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
863 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
864 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
719
865
720 m_axis->setShadesBrush(shadesBrush);
866 m_axis->setShadesBrush(shadesBrush);
721 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
867 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
@@ -730,6 +876,8 void tst_QAbstractAxis::shadesBrush()
730 QCOMPARE(spy7.count(), 0);
876 QCOMPARE(spy7.count(), 0);
731 QCOMPARE(spy8.count(), 0);
877 QCOMPARE(spy8.count(), 0);
732 QCOMPARE(spy9.count(), 0);
878 QCOMPARE(spy9.count(), 0);
879 QCOMPARE(spy10.count(), 0);
880 QCOMPARE(spy11.count(), 0);
733
881
734 m_view->show();
882 m_view->show();
735 QTest::qWaitForWindowShown(m_view);
883 QTest::qWaitForWindowShown(m_view);
@@ -769,6 +917,8 void tst_QAbstractAxis::shadesPen()
769 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
917 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
770 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
918 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
771 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
919 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
920 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
921 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
772
922
773 m_axis->setShadesPen(shadesPen);
923 m_axis->setShadesPen(shadesPen);
774 QCOMPARE(m_axis->shadesPen(), shadesPen);
924 QCOMPARE(m_axis->shadesPen(), shadesPen);
@@ -783,6 +933,8 void tst_QAbstractAxis::shadesPen()
783 QCOMPARE(spy7.count(), 0);
933 QCOMPARE(spy7.count(), 0);
784 QCOMPARE(spy8.count(), 0);
934 QCOMPARE(spy8.count(), 0);
785 QCOMPARE(spy9.count(), 0);
935 QCOMPARE(spy9.count(), 0);
936 QCOMPARE(spy10.count(), 0);
937 QCOMPARE(spy11.count(), 0);
786
938
787 m_chart->setAxisX(m_axis, m_series);
939 m_chart->setAxisX(m_axis, m_series);
788 m_view->show();
940 m_view->show();
@@ -813,6 +965,8 void tst_QAbstractAxis::shadesVisible()
813 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
965 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
814 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
966 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
815 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
967 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
968 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
969 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
816
970
817 m_axis->setShadesVisible(shadesVisible);
971 m_axis->setShadesVisible(shadesVisible);
818 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
972 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
@@ -827,6 +981,8 void tst_QAbstractAxis::shadesVisible()
827 QCOMPARE(spy7.count(), 1);
981 QCOMPARE(spy7.count(), 1);
828 QCOMPARE(spy8.count(), 0);
982 QCOMPARE(spy8.count(), 0);
829 QCOMPARE(spy9.count(), 0);
983 QCOMPARE(spy9.count(), 0);
984 QCOMPARE(spy10.count(), 0);
985 QCOMPARE(spy11.count(), 0);
830
986
831 m_chart->setAxisX(m_axis, m_series);
987 m_chart->setAxisX(m_axis, m_series);
832 m_view->show();
988 m_view->show();
@@ -854,6 +1010,8 void tst_QAbstractAxis::show()
854 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
1010 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
855 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
1011 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
856 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
1012 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
1013 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
1014 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
857
1015
858 m_axis->show();
1016 m_axis->show();
859
1017
@@ -867,6 +1025,8 void tst_QAbstractAxis::show()
867 QCOMPARE(spy7.count(), 0);
1025 QCOMPARE(spy7.count(), 0);
868 QCOMPARE(spy8.count(), 1);
1026 QCOMPARE(spy8.count(), 1);
869 QCOMPARE(spy9.count(), 0);
1027 QCOMPARE(spy9.count(), 0);
1028 QCOMPARE(spy10.count(), 0);
1029 QCOMPARE(spy11.count(), 0);
870 QCOMPARE(m_axis->isVisible(), true);
1030 QCOMPARE(m_axis->isVisible(), true);
871 }
1031 }
872
1032
@@ -890,6 +1050,8 void tst_QAbstractAxis::hide()
890 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
1050 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
891 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
1051 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
892 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
1052 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
1053 QSignalSpy spy10(m_axis, SIGNAL(gridLineColorChanged(QColor)));
1054 QSignalSpy spy11(m_axis, SIGNAL(minorGridLineColorChanged(QColor)));
893
1055
894 m_axis->hide();
1056 m_axis->hide();
895
1057
@@ -903,6 +1065,8 void tst_QAbstractAxis::hide()
903 QCOMPARE(spy7.count(), 0);
1065 QCOMPARE(spy7.count(), 0);
904 QCOMPARE(spy8.count(), 1);
1066 QCOMPARE(spy8.count(), 1);
905 QCOMPARE(spy9.count(), 0);
1067 QCOMPARE(spy9.count(), 0);
1068 QCOMPARE(spy10.count(), 0);
1069 QCOMPARE(spy11.count(), 0);
906 QCOMPARE(m_axis->isVisible(),false);
1070 QCOMPARE(m_axis->isVisible(),false);
907 }
1071 }
908
1072
@@ -51,6 +51,10 private slots:
51 void gridLineVisible();
51 void gridLineVisible();
52 void minorGridLineVisible_data();
52 void minorGridLineVisible_data();
53 void minorGridLineVisible();
53 void minorGridLineVisible();
54 void gridLineColor_data();
55 void gridLineColor();
56 void minorGridLineColor_data();
57 void minorGridLineColor();
54 void visible_data();
58 void visible_data();
55 void visible();
59 void visible();
56 void labelsAngle_data();
60 void labelsAngle_data();
@@ -169,6 +169,8 MainWindow::MainWindow(QWidget *parent) :
169 this, SLOT(gridIndexChanged(int)));
169 this, SLOT(gridIndexChanged(int)));
170 connect(ui->minorGridComboBox, SIGNAL(currentIndexChanged(int)),
170 connect(ui->minorGridComboBox, SIGNAL(currentIndexChanged(int)),
171 this, SLOT(minorGridIndexChanged(int)));
171 this, SLOT(minorGridIndexChanged(int)));
172 connect(ui->gridLineColorComboBox, SIGNAL(currentIndexChanged(int)),
173 this, SLOT(gridLineColorIndexChanged(int)));
172 connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)),
174 connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)),
173 this, SLOT(arrowIndexChanged(int)));
175 this, SLOT(arrowIndexChanged(int)));
174 connect(ui->logBaseSpin, SIGNAL(valueChanged(double)),
176 connect(ui->logBaseSpin, SIGNAL(valueChanged(double)),
@@ -956,6 +958,29 void MainWindow::minorGridIndexChanged(int index)
956 m_radialAxis->setMinorGridLineVisible(m_minorGridVisible);
958 m_radialAxis->setMinorGridLineVisible(m_minorGridVisible);
957 }
959 }
958
960
961 void MainWindow::gridLineColorIndexChanged(int index)
962 {
963 QColor color;
964 switch (index) {
965 case 0:
966 color = Qt::black;
967 break;
968 case 1:
969 color = Qt::green;
970 break;
971 case 2:
972 color = Qt::red;
973 break;
974 default:
975 break;
976 }
977
978 m_angularAxis->setGridLineColor(color);
979 m_radialAxis->setGridLineColor(color);
980 m_angularAxis->setMinorGridLineColor(color);
981 m_radialAxis->setMinorGridLineColor(color);
982 }
983
959 void MainWindow::arrowIndexChanged(int index)
984 void MainWindow::arrowIndexChanged(int index)
960 {
985 {
961 delete m_arrowPen;
986 delete m_arrowPen;
@@ -70,6 +70,7 public slots:
70 void titleFontSizeChanged(int value);
70 void titleFontSizeChanged(int value);
71 void gridIndexChanged(int index);
71 void gridIndexChanged(int index);
72 void minorGridIndexChanged(int index);
72 void minorGridIndexChanged(int index);
73 void gridLineColorIndexChanged(int index);
73 void arrowIndexChanged(int index);
74 void arrowIndexChanged(int index);
74 void angularRangeChanged(qreal min, qreal max);
75 void angularRangeChanged(qreal min, qreal max);
75 void radialRangeChanged(qreal min, qreal max);
76 void radialRangeChanged(qreal min, qreal max);
@@ -335,7 +335,7
335 <property name="geometry">
335 <property name="geometry">
336 <rect>
336 <rect>
337 <x>10</x>
337 <x>10</x>
338 <y>814</y>
338 <y>810</y>
339 <width>131</width>
339 <width>131</width>
340 <height>20</height>
340 <height>20</height>
341 </rect>
341 </rect>
@@ -394,7 +394,7
394 <property name="geometry">
394 <property name="geometry">
395 <rect>
395 <rect>
396 <x>10</x>
396 <x>10</x>
397 <y>840</y>
397 <y>830</y>
398 <width>117</width>
398 <width>117</width>
399 <height>16</height>
399 <height>16</height>
400 </rect>
400 </rect>
@@ -689,7 +689,7
689 <rect>
689 <rect>
690 <x>10</x>
690 <x>10</x>
691 <y>680</y>
691 <y>680</y>
692 <width>191</width>
692 <width>198</width>
693 <height>31</height>
693 <height>31</height>
694 </rect>
694 </rect>
695 </property>
695 </property>
@@ -714,7 +714,7
714 <property name="geometry">
714 <property name="geometry">
715 <rect>
715 <rect>
716 <x>10</x>
716 <x>10</x>
717 <y>740</y>
717 <y>730</y>
718 <width>221</width>
718 <width>221</width>
719 <height>22</height>
719 <height>22</height>
720 </rect>
720 </rect>
@@ -736,7 +736,7
736 <property name="geometry">
736 <property name="geometry">
737 <rect>
737 <rect>
738 <x>10</x>
738 <x>10</x>
739 <y>766</y>
739 <y>760</y>
740 <width>136</width>
740 <width>136</width>
741 <height>42</height>
741 <height>42</height>
742 </rect>
742 </rect>
@@ -912,6 +912,40
912 <string>Category Label On Tick</string>
912 <string>Category Label On Tick</string>
913 </property>
913 </property>
914 </widget>
914 </widget>
915 <widget class="QComboBox" name="gridLineColorComboBox">
916 <property name="geometry">
917 <rect>
918 <x>10</x>
919 <y>850</y>
920 <width>133</width>
921 <height>20</height>
922 </rect>
923 </property>
924 <property name="sizePolicy">
925 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
926 <horstretch>0</horstretch>
927 <verstretch>0</verstretch>
928 </sizepolicy>
929 </property>
930 <property name="currentIndex">
931 <number>0</number>
932 </property>
933 <item>
934 <property name="text">
935 <string>Black grid line</string>
936 </property>
937 </item>
938 <item>
939 <property name="text">
940 <string>Green grid line</string>
941 </property>
942 </item>
943 <item>
944 <property name="text">
945 <string>Red grid line</string>
946 </property>
947 </item>
948 </widget>
915 </widget>
949 </widget>
916 </item>
950 </item>
917 </layout>
951 </layout>
@@ -72,11 +72,16 ChartView {
72
72
73 ValueAxis{
73 ValueAxis{
74 id: axisX
74 id: axisX
75 minorGridVisible: false
76 minorTickCount: 2
75 onColorChanged: console.log("axisX.onColorChanged: " + color);
77 onColorChanged: console.log("axisX.onColorChanged: " + color);
76 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
78 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
77 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
79 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
78 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
80 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
79 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
81 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
82 onMinorGridVisibleChanged: console.log("axisX.onMinorGridVisibleChanged: " + visible);
83 onGridLineColorChanged: console.log("axisX.onGridLineColorChanged: " + color);
84 onMinorGridLineColorChanged: console.log("axisX.onMinorGridLineColorChanged: " + color);
80 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
85 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
81 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
86 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
82 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
87 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
@@ -87,11 +92,16 ChartView {
87
92
88 ValueAxis{
93 ValueAxis{
89 id: axisY
94 id: axisY
95 minorGridVisible: false
96 minorTickCount: 2
90 onColorChanged: console.log("axisY.onColorChanged: " + color);
97 onColorChanged: console.log("axisY.onColorChanged: " + color);
91 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
98 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
92 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
99 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
93 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
100 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
94 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
101 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
102 onMinorGridVisibleChanged: console.log("axisX.onMinorGridVisibleChanged: " + visible);
103 onGridLineColorChanged: console.log("axisX.onGridLineColorChanged: " + color);
104 onMinorGridLineColorChanged: console.log("axisX.onMinorGridLineColorChanged: " + color);
95 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
105 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
96 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
106 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
97 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
107 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
@@ -65,6 +65,14 Row {
65 onClicked: axis.minorGridVisible = !axis.minorGridVisible;
65 onClicked: axis.minorGridVisible = !axis.minorGridVisible;
66 }
66 }
67 Button {
67 Button {
68 text: "axis grid color"
69 onClicked: axis.gridLineColor = main.nextColor();
70 }
71 Button {
72 text: "axis minor grid color"
73 onClicked: axis.minorGridLineColor = main.nextColor();
74 }
75 Button {
68 text: "axis shades visible"
76 text: "axis shades visible"
69 onClicked: axis.shadesVisible = !axis.shadesVisible;
77 onClicked: axis.shadesVisible = !axis.shadesVisible;
70 }
78 }
General Comments 0
You need to be logged in to leave comments. Login now