##// END OF EJS Templates
Adds visibity paramter to axis
Michal Klocek -
r1617:07b0bddfc311
parent child
Show More
@@ -260,30 +260,42 void ChartAxis::handleAxisUpdated()
260
260
261 if (isEmpty()) return;
261 if (isEmpty()) return;
262
262
263 if (m_chartAxis->isAxisVisible()) {
263 if (!m_chartAxis->isVisible()) {
264 setAxisOpacity(100);
265 } else {
266 setAxisOpacity(0);
264 setAxisOpacity(0);
267 }
268
269 if (m_chartAxis->isGridLineVisible()) {
270 setGridOpacity(100);
271 } else {
272 setGridOpacity(0);
265 setGridOpacity(0);
273 }
274
275 if (m_chartAxis->labelsVisible()) {
276 setLabelsOpacity(100);
277 } else {
278 setLabelsOpacity(0);
266 setLabelsOpacity(0);
279 }
280
281 if (m_chartAxis->shadesVisible()) {
282 setShadesOpacity(100);
283 } else {
284 setShadesOpacity(0);
267 setShadesOpacity(0);
285 }
268 }
269 else {
270
271 if (m_chartAxis->isAxisVisible()) {
272 setAxisOpacity(100);
273 }
274 else {
275 setAxisOpacity(0);
276 }
286
277
278 if (m_chartAxis->isGridLineVisible()) {
279 setGridOpacity(100);
280 }
281 else {
282 setGridOpacity(0);
283 }
284
285 if (m_chartAxis->labelsVisible()) {
286 setLabelsOpacity(100);
287 }
288 else {
289 setLabelsOpacity(0);
290 }
291
292 if (m_chartAxis->shadesVisible()) {
293 setShadesOpacity(100);
294 }
295 else {
296 setShadesOpacity(0);
297 }
298 }
287 setLabelsAngle(m_chartAxis->labelsAngle());
299 setLabelsAngle(m_chartAxis->labelsAngle());
288 setAxisPen(m_chartAxis->axisPen());
300 setAxisPen(m_chartAxis->axisPen());
289 setLabelsPen(m_chartAxis->labelsPen());
301 setLabelsPen(m_chartAxis->labelsPen());
@@ -519,28 +519,35 QColor QAbstractAxis::shadesBorderColor() const
519 }
519 }
520
520
521
521
522 bool QAbstractAxis::isVisible() const
523 {
524 return d_ptr->m_visible;
525 }
526
522 /*!
527 /*!
523 Sets axis, shades, labels and grid lines to be visible.
528 Sets axis, shades, labels and grid lines to be visible.
524 */
529 */
525 void QAbstractAxis::show()
530 void QAbstractAxis::setVisible(bool visible)
526 {
531 {
527 d_ptr->m_axisVisible=true;
532 d_ptr->m_visible=visible;
528 d_ptr->m_gridLineVisible=true;
529 d_ptr->m_labelsVisible=true;
530 d_ptr->m_shadesVisible=true;
531 emit d_ptr->updated();
533 emit d_ptr->updated();
532 }
534 }
533
535
536
537 /*!
538 Sets axis, shades, labels and grid lines to be visible.
539 */
540 void QAbstractAxis::show()
541 {
542 setVisible(true);
543 }
544
534 /*!
545 /*!
535 Sets axis, shades, labels and grid lines to not be visible.
546 Sets axis, shades, labels and grid lines to not be visible.
536 */
547 */
537 void QAbstractAxis::hide()
548 void QAbstractAxis::hide()
538 {
549 {
539 d_ptr->m_axisVisible = false;
550 setVisible(false);
540 d_ptr->m_gridLineVisible = false;
541 d_ptr->m_labelsVisible = false;
542 d_ptr->m_shadesVisible = false;
543 emit d_ptr->updated();
544 }
551 }
545
552
546
553
@@ -561,6 +568,7 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
561
568
562 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q):
569 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q):
563 q_ptr(q),
570 q_ptr(q),
571 m_visible(true),
564 m_axisVisible(true),
572 m_axisVisible(true),
565 m_gridLineVisible(true),
573 m_gridLineVisible(true),
566 m_labelsVisible(true),
574 m_labelsVisible(true),
@@ -33,8 +33,8 class QAbstractAxisPrivate;
33 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
33 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36
36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
37 Q_PROPERTY(bool visible READ isAxisVisible WRITE setAxisVisible NOTIFY visibleChanged)
37 Q_PROPERTY(bool axisVisible READ isAxisVisible WRITE setAxisVisible NOTIFY visibleChanged)
38 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged)
38 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor 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)
@@ -63,6 +63,11 public:
63
63
64 virtual AxisType type() const = 0;
64 virtual AxisType type() const = 0;
65
65
66 //visibilty hadnling
67 bool isVisible() const;
68 void setVisible(bool visible = true);
69
70
66 //axis handling
71 //axis handling
67 bool isAxisVisible() const;
72 bool isAxisVisible() const;
68 void setAxisVisible(bool visible = true);
73 void setAxisVisible(bool visible = true);
@@ -113,6 +118,7 public:
113
118
114 Q_SIGNALS:
119 Q_SIGNALS:
115 void visibleChanged(bool visible);
120 void visibleChanged(bool visible);
121 void axisVisibleChanged(bool visible);
116 void labelsVisibleChanged(bool visible);
122 void labelsVisibleChanged(bool visible);
117 void gridVisibleChanged(bool visible);
123 void gridVisibleChanged(bool visible);
118 void colorChanged(QColor color);
124 void colorChanged(QColor color);
@@ -59,6 +59,7 protected:
59
59
60 public:
60 public:
61 QAbstractAxis *q_ptr;
61 QAbstractAxis *q_ptr;
62 bool m_visible;
62
63
63 bool m_axisVisible;
64 bool m_axisVisible;
64 QPen m_axisPen;
65 QPen m_axisPen;
General Comments 0
You need to be logged in to leave comments. Login now