##// 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 74 // Customize axis colors
75 75 QPen axisPen(QRgb(0xd18952));
76 76 axisPen.setWidth(2);
77 axisX->setAxisPen(axisPen);
78 axisY->setAxisPen(axisPen);
77 axisX->setLinePen(axisPen);
78 axisY->setLinePen(axisPen);
79 79
80 80 // Customize axis label colors
81 81 QBrush axisBrush(Qt::white);
@@ -299,12 +299,12 void ChartAxis::handleAxisUpdated()
299 299
300 300 bool visible = m_chartAxis->isVisible();
301 301
302 setArrowVisibility(visible && m_chartAxis->isArrowVisible());
302 setArrowVisibility(visible && m_chartAxis->isLineVisible());
303 303 setGridVisibility(visible && m_chartAxis->isGridLineVisible());
304 304 setLabelsVisibility(visible && m_chartAxis->labelsVisible());
305 305 setShadesVisibility(visible && m_chartAxis->shadesVisible());
306 306 setLabelsAngle(m_chartAxis->labelsAngle());
307 setArrowPen(m_chartAxis->axisPen());
307 setArrowPen(m_chartAxis->linePen());
308 308 setLabelsPen(m_chartAxis->labelsPen());
309 309 setLabelsBrush(m_chartAxis->labelsBrush());
310 310 setLabelsFont(m_chartAxis->labelsFont());
@@ -278,7 +278,7 QAbstractAxis::~QAbstractAxis()
278 278 /*!
279 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 283 if (d_ptr->m_axisPen!=pen) {
284 284 d_ptr->m_axisPen = pen;
@@ -289,22 +289,22 void QAbstractAxis::setAxisPen(const QPen &pen)
289 289 /*!
290 290 Returns pen used to draw axis and ticks.
291 291 */
292 QPen QAbstractAxis::axisPen() const
292 QPen QAbstractAxis::linePen() const
293 293 {
294 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 299 QPen p = d_ptr->m_axisPen;
300 300 if (p.color() != color) {
301 301 p.setColor(color);
302 setAxisPen(p);
302 setLinePen(p);
303 303 emit colorChanged(color);
304 304 }
305 305 }
306 306
307 QColor QAbstractAxis::axisPenColor() const
307 QColor QAbstractAxis::linePenColor() const
308 308 {
309 309 return d_ptr->m_axisPen.color();
310 310 }
@@ -312,16 +312,16 QColor QAbstractAxis::axisPenColor() const
312 312 /*!
313 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 317 if (d_ptr->m_arrowVisible != visible) {
318 318 d_ptr->m_arrowVisible = visible;
319 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 326 return d_ptr->m_arrowVisible;
327 327 }
@@ -34,8 +34,8 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
34 34 {
35 35 Q_OBJECT
36 36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
37 Q_PROPERTY(bool arrowVisible READ isArrowVisible WRITE setArrowVisible NOTIFY arrowVisibleChanged)
38 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged)
37 Q_PROPERTY(bool arrowVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
38 Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
39 39 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
40 40 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
41 41 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont)
@@ -71,12 +71,12 public:
71 71
72 72
73 73 //axis handling
74 bool isArrowVisible() const;
75 void setArrowVisible(bool visible = true);
76 void setAxisPen(const QPen &pen);
77 QPen axisPen() const;
78 void setAxisPenColor(QColor color);
79 QColor axisPenColor() const;
74 bool isLineVisible() const;
75 void setLineVisible(bool visible = true);
76 void setLinePen(const QPen &pen);
77 QPen linePen() const;
78 void setLinePenColor(QColor color);
79 QColor linePenColor() const;
80 80
81 81 //grid handling
82 82 bool isGridLineVisible() const;
@@ -122,7 +122,7 public:
122 122
123 123 Q_SIGNALS:
124 124 void visibleChanged(bool visible);
125 void arrowVisibleChanged(bool visible);
125 void lineVisibleChanged(bool visible);
126 126 void labelsVisibleChanged(bool visible);
127 127 void gridVisibleChanged(bool visible);
128 128 void colorChanged(QColor color);
@@ -266,7 +266,7 void ChartTheme::decorate(QAbstractAxis *axis)
266 266
267 267 bool axisX = axis->orientation()== Qt::Horizontal;
268 268
269 if (axis->isArrowVisible()) {
269 if (axis->isLineVisible()) {
270 270
271 271 if(m_force || brush == axis->labelsBrush()){
272 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()){
298 axis->setAxisPen(m_axisLinePen);
297 if(m_force || pen == axis->linePen()){
298 axis->setLinePen(m_axisLinePen);
299 299 }
300 300
301 301 if(m_force || pen == axis->gridLinePen()){
@@ -49,10 +49,10 void tst_QAbstractAxis::cleanup()
49 49
50 50 void tst_QAbstractAxis::qabstractaxis()
51 51 {
52 QCOMPARE(m_axis->axisPen(), QPen());
52 QCOMPARE(m_axis->linePen(), QPen());
53 53 //TODO QCOMPARE(m_axis->axisPenColor(), QColor());
54 54 QCOMPARE(m_axis->gridLinePen(), QPen());
55 QCOMPARE(m_axis->isArrowVisible(), true);
55 QCOMPARE(m_axis->isLineVisible(), true);
56 56 QCOMPARE(m_axis->isGridLineVisible(), true);
57 57 QCOMPARE(m_axis->isVisible(), false);
58 58 QCOMPARE(m_axis->labelsAngle(), 0);
@@ -62,9 +62,9 void tst_QAbstractAxis::qabstractaxis()
62 62 QCOMPARE(m_axis->labelsPen(), QPen());
63 63 QCOMPARE(m_axis->labelsVisible(), true);
64 64 QCOMPARE(m_axis->orientation(), Qt::Orientation(0));
65 m_axis->setArrowVisible(false);
66 m_axis->setAxisPen(QPen());
67 m_axis->setAxisPenColor(QColor());
65 m_axis->setLineVisible(false);
66 m_axis->setLinePen(QPen());
67 m_axis->setLinePenColor(QColor());
68 68 m_axis->setGridLinePen(QPen());
69 69 m_axis->setGridLineVisible(false);
70 70 m_axis->setLabelsAngle(-1);
@@ -114,8 +114,8 void tst_QAbstractAxis::axisPen()
114 114 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
115 115 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
116 116
117 m_axis->setAxisPen(axisPen);
118 QCOMPARE(m_axis->axisPen(), axisPen);
117 m_axis->setLinePen(axisPen);
118 QCOMPARE(m_axis->linePen(), axisPen);
119 119
120 120 QCOMPARE(spy0.count(), 0);
121 121 QCOMPARE(spy1.count(), 0);
@@ -197,7 +197,7 void tst_QAbstractAxis::arrowVisible()
197 197 {
198 198 QFETCH(bool, arrowVisible);
199 199
200 m_axis->setArrowVisible(!arrowVisible);
200 m_axis->setLineVisible(!arrowVisible);
201 201
202 202 QSignalSpy spy0(m_axis, SIGNAL(arrowVisibleChanged(bool)));
203 203 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
@@ -209,8 +209,8 void tst_QAbstractAxis::arrowVisible()
209 209 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
210 210 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
211 211
212 m_axis->setArrowVisible(arrowVisible);
213 QCOMPARE(m_axis->isArrowVisible(), arrowVisible);
212 m_axis->setLineVisible(arrowVisible);
213 QCOMPARE(m_axis->isLineVisible(), arrowVisible);
214 214
215 215 QCOMPARE(spy0.count(), 1);
216 216 QCOMPARE(spy1.count(), 0);
@@ -225,7 +225,7 void tst_QAbstractAxis::arrowVisible()
225 225 m_chart->setAxisX(m_axis, m_series);
226 226 m_view->show();
227 227 QTest::qWaitForWindowShown(m_view);
228 QCOMPARE(m_axis->isArrowVisible(), arrowVisible);
228 QCOMPARE(m_axis->isLineVisible(), arrowVisible);
229 229 }
230 230
231 231 void tst_QAbstractAxis::gridLineVisible_data()
General Comments 0
You need to be logged in to leave comments. Login now