##// END OF EJS Templates
QAbstractAxis: renamed Arrow and Axis to line in methods names
Marek Rosa -
r1844:691cce09e051
parent child
Show More
@@ -74,8 +74,8 int main(int argc, char *argv[])
74 // Customize axis colors
74 // Customize axis colors
75 QPen axisPen(QRgb(0xd18952));
75 QPen axisPen(QRgb(0xd18952));
76 axisPen.setWidth(2);
76 axisPen.setWidth(2);
77 axisX->setAxisPen(axisPen);
77 axisX->setLinePen(axisPen);
78 axisY->setAxisPen(axisPen);
78 axisY->setLinePen(axisPen);
79
79
80 // Customize axis label colors
80 // Customize axis label colors
81 QBrush axisBrush(Qt::white);
81 QBrush axisBrush(Qt::white);
@@ -299,12 +299,12 void ChartAxis::handleAxisUpdated()
299
299
300 bool visible = m_chartAxis->isVisible();
300 bool visible = m_chartAxis->isVisible();
301
301
302 setArrowVisibility(visible && m_chartAxis->isArrowVisible());
302 setArrowVisibility(visible && m_chartAxis->isLineVisible());
303 setGridVisibility(visible && m_chartAxis->isGridLineVisible());
303 setGridVisibility(visible && m_chartAxis->isGridLineVisible());
304 setLabelsVisibility(visible && m_chartAxis->labelsVisible());
304 setLabelsVisibility(visible && m_chartAxis->labelsVisible());
305 setShadesVisibility(visible && m_chartAxis->shadesVisible());
305 setShadesVisibility(visible && m_chartAxis->shadesVisible());
306 setLabelsAngle(m_chartAxis->labelsAngle());
306 setLabelsAngle(m_chartAxis->labelsAngle());
307 setArrowPen(m_chartAxis->axisPen());
307 setArrowPen(m_chartAxis->linePen());
308 setLabelsPen(m_chartAxis->labelsPen());
308 setLabelsPen(m_chartAxis->labelsPen());
309 setLabelsBrush(m_chartAxis->labelsBrush());
309 setLabelsBrush(m_chartAxis->labelsBrush());
310 setLabelsFont(m_chartAxis->labelsFont());
310 setLabelsFont(m_chartAxis->labelsFont());
@@ -278,7 +278,7 QAbstractAxis::~QAbstractAxis()
278 /*!
278 /*!
279 Sets \a pen used to draw axis line and ticks.
279 Sets \a pen used to draw axis line and ticks.
280 */
280 */
281 void QAbstractAxis::setAxisPen(const QPen &pen)
281 void QAbstractAxis::setLinePen(const QPen &pen)
282 {
282 {
283 if (d_ptr->m_axisPen!=pen) {
283 if (d_ptr->m_axisPen!=pen) {
284 d_ptr->m_axisPen = pen;
284 d_ptr->m_axisPen = pen;
@@ -289,22 +289,22 void QAbstractAxis::setAxisPen(const QPen &pen)
289 /*!
289 /*!
290 Returns pen used to draw axis and ticks.
290 Returns pen used to draw axis and ticks.
291 */
291 */
292 QPen QAbstractAxis::axisPen() const
292 QPen QAbstractAxis::linePen() const
293 {
293 {
294 return d_ptr->m_axisPen;
294 return d_ptr->m_axisPen;
295 }
295 }
296
296
297 void QAbstractAxis::setAxisPenColor(QColor color)
297 void QAbstractAxis::setLinePenColor(QColor color)
298 {
298 {
299 QPen p = d_ptr->m_axisPen;
299 QPen p = d_ptr->m_axisPen;
300 if (p.color() != color) {
300 if (p.color() != color) {
301 p.setColor(color);
301 p.setColor(color);
302 setAxisPen(p);
302 setLinePen(p);
303 emit colorChanged(color);
303 emit colorChanged(color);
304 }
304 }
305 }
305 }
306
306
307 QColor QAbstractAxis::axisPenColor() const
307 QColor QAbstractAxis::linePenColor() const
308 {
308 {
309 return d_ptr->m_axisPen.color();
309 return d_ptr->m_axisPen.color();
310 }
310 }
@@ -312,16 +312,16 QColor QAbstractAxis::axisPenColor() const
312 /*!
312 /*!
313 Sets if axis and ticks are \a visible.
313 Sets if axis and ticks are \a visible.
314 */
314 */
315 void QAbstractAxis::setArrowVisible(bool visible)
315 void QAbstractAxis::setLineVisible(bool visible)
316 {
316 {
317 if (d_ptr->m_arrowVisible != visible) {
317 if (d_ptr->m_arrowVisible != visible) {
318 d_ptr->m_arrowVisible = visible;
318 d_ptr->m_arrowVisible = visible;
319 d_ptr->emitUpdated();
319 d_ptr->emitUpdated();
320 emit arrowVisibleChanged(visible);
320 emit lineVisibleChanged(visible);
321 }
321 }
322 }
322 }
323
323
324 bool QAbstractAxis::isArrowVisible() const
324 bool QAbstractAxis::isLineVisible() const
325 {
325 {
326 return d_ptr->m_arrowVisible;
326 return d_ptr->m_arrowVisible;
327 }
327 }
@@ -34,8 +34,8 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
37 Q_PROPERTY(bool arrowVisible READ isArrowVisible WRITE setArrowVisible NOTIFY arrowVisibleChanged)
37 Q_PROPERTY(bool arrowVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
38 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged)
38 Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
39 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
39 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
40 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
40 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
41 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont)
41 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont)
@@ -71,12 +71,12 public:
71
71
72
72
73 //axis handling
73 //axis handling
74 bool isArrowVisible() const;
74 bool isLineVisible() const;
75 void setArrowVisible(bool visible = true);
75 void setLineVisible(bool visible = true);
76 void setAxisPen(const QPen &pen);
76 void setLinePen(const QPen &pen);
77 QPen axisPen() const;
77 QPen linePen() const;
78 void setAxisPenColor(QColor color);
78 void setLinePenColor(QColor color);
79 QColor axisPenColor() const;
79 QColor linePenColor() const;
80
80
81 //grid handling
81 //grid handling
82 bool isGridLineVisible() const;
82 bool isGridLineVisible() const;
@@ -122,7 +122,7 public:
122
122
123 Q_SIGNALS:
123 Q_SIGNALS:
124 void visibleChanged(bool visible);
124 void visibleChanged(bool visible);
125 void arrowVisibleChanged(bool visible);
125 void lineVisibleChanged(bool visible);
126 void labelsVisibleChanged(bool visible);
126 void labelsVisibleChanged(bool visible);
127 void gridVisibleChanged(bool visible);
127 void gridVisibleChanged(bool visible);
128 void colorChanged(QColor color);
128 void colorChanged(QColor color);
@@ -266,7 +266,7 void ChartTheme::decorate(QAbstractAxis *axis)
266
266
267 bool axisX = axis->orientation()== Qt::Horizontal;
267 bool axisX = axis->orientation()== Qt::Horizontal;
268
268
269 if (axis->isArrowVisible()) {
269 if (axis->isLineVisible()) {
270
270
271 if(m_force || brush == axis->labelsBrush()){
271 if(m_force || brush == axis->labelsBrush()){
272 axis->setLabelsBrush(m_labelBrush);
272 axis->setLabelsBrush(m_labelBrush);
@@ -294,8 +294,8 void ChartTheme::decorate(QAbstractAxis *axis)
294 }
294 }
295 }
295 }
296
296
297 if(m_force || pen == axis->axisPen()){
297 if(m_force || pen == axis->linePen()){
298 axis->setAxisPen(m_axisLinePen);
298 axis->setLinePen(m_axisLinePen);
299 }
299 }
300
300
301 if(m_force || pen == axis->gridLinePen()){
301 if(m_force || pen == axis->gridLinePen()){
@@ -49,10 +49,10 void tst_QAbstractAxis::cleanup()
49
49
50 void tst_QAbstractAxis::qabstractaxis()
50 void tst_QAbstractAxis::qabstractaxis()
51 {
51 {
52 QCOMPARE(m_axis->axisPen(), 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->isArrowVisible(), true);
55 QCOMPARE(m_axis->isLineVisible(), true);
56 QCOMPARE(m_axis->isGridLineVisible(), true);
56 QCOMPARE(m_axis->isGridLineVisible(), true);
57 QCOMPARE(m_axis->isVisible(), false);
57 QCOMPARE(m_axis->isVisible(), false);
58 QCOMPARE(m_axis->labelsAngle(), 0);
58 QCOMPARE(m_axis->labelsAngle(), 0);
@@ -62,9 +62,9 void tst_QAbstractAxis::qabstractaxis()
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->setArrowVisible(false);
65 m_axis->setLineVisible(false);
66 m_axis->setAxisPen(QPen());
66 m_axis->setLinePen(QPen());
67 m_axis->setAxisPenColor(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);
@@ -114,8 +114,8 void tst_QAbstractAxis::axisPen()
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->setAxisPen(axisPen);
117 m_axis->setLinePen(axisPen);
118 QCOMPARE(m_axis->axisPen(), 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);
@@ -197,7 +197,7 void tst_QAbstractAxis::arrowVisible()
197 {
197 {
198 QFETCH(bool, arrowVisible);
198 QFETCH(bool, arrowVisible);
199
199
200 m_axis->setArrowVisible(!arrowVisible);
200 m_axis->setLineVisible(!arrowVisible);
201
201
202 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
202 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
203 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
203 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
@@ -209,8 +209,8 void tst_QAbstractAxis::arrowVisible()
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->setArrowVisible(arrowVisible);
212 m_axis->setLineVisible(arrowVisible);
213 QCOMPARE(m_axis->isArrowVisible(), arrowVisible);
213 QCOMPARE(m_axis->isLineVisible(), arrowVisible);
214
214
215 QCOMPARE(spy0.count(), 1);
215 QCOMPARE(spy0.count(), 1);
216 QCOMPARE(spy1.count(), 0);
216 QCOMPARE(spy1.count(), 0);
@@ -225,7 +225,7 void tst_QAbstractAxis::arrowVisible()
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->isArrowVisible(), arrowVisible);
228 QCOMPARE(m_axis->isLineVisible(), arrowVisible);
229 }
229 }
230
230
231 void tst_QAbstractAxis::gridLineVisible_data()
231 void tst_QAbstractAxis::gridLineVisible_data()
General Comments 0
You need to be logged in to leave comments. Login now