##// 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 261 if (isEmpty()) return;
262 262
263 if (m_chartAxis->isAxisVisible()) {
264 setAxisOpacity(100);
265 } else {
263 if (!m_chartAxis->isVisible()) {
266 264 setAxisOpacity(0);
267 }
268
269 if (m_chartAxis->isGridLineVisible()) {
270 setGridOpacity(100);
271 } else {
272 265 setGridOpacity(0);
273 }
274
275 if (m_chartAxis->labelsVisible()) {
276 setLabelsOpacity(100);
277 } else {
278 266 setLabelsOpacity(0);
279 }
280
281 if (m_chartAxis->shadesVisible()) {
282 setShadesOpacity(100);
283 } else {
284 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 299 setLabelsAngle(m_chartAxis->labelsAngle());
288 300 setAxisPen(m_chartAxis->axisPen());
289 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 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;
528 d_ptr->m_gridLineVisible=true;
529 d_ptr->m_labelsVisible=true;
530 d_ptr->m_shadesVisible=true;
532 d_ptr->m_visible=visible;
531 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 546 Sets axis, shades, labels and grid lines to not be visible.
536 547 */
537 548 void QAbstractAxis::hide()
538 549 {
539 d_ptr->m_axisVisible = false;
540 d_ptr->m_gridLineVisible = false;
541 d_ptr->m_labelsVisible = false;
542 d_ptr->m_shadesVisible = false;
543 emit d_ptr->updated();
550 setVisible(false);
544 551 }
545 552
546 553
@@ -561,6 +568,7 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
561 568
562 569 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis* q):
563 570 q_ptr(q),
571 m_visible(true),
564 572 m_axisVisible(true),
565 573 m_gridLineVisible(true),
566 574 m_labelsVisible(true),
@@ -33,8 +33,8 class QAbstractAxisPrivate;
33 33 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
34 34 {
35 35 Q_OBJECT
36
37 Q_PROPERTY(bool visible READ isAxisVisible WRITE setAxisVisible NOTIFY visibleChanged)
36 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
37 Q_PROPERTY(bool axisVisible READ isAxisVisible WRITE setAxisVisible NOTIFY visibleChanged)
38 38 Q_PROPERTY(QColor color READ axisPenColor WRITE setAxisPenColor NOTIFY colorChanged)
39 39 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
40 40 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle)
@@ -63,6 +63,11 public:
63 63
64 64 virtual AxisType type() const = 0;
65 65
66 //visibilty hadnling
67 bool isVisible() const;
68 void setVisible(bool visible = true);
69
70
66 71 //axis handling
67 72 bool isAxisVisible() const;
68 73 void setAxisVisible(bool visible = true);
@@ -113,6 +118,7 public:
113 118
114 119 Q_SIGNALS:
115 120 void visibleChanged(bool visible);
121 void axisVisibleChanged(bool visible);
116 122 void labelsVisibleChanged(bool visible);
117 123 void gridVisibleChanged(bool visible);
118 124 void colorChanged(QColor color);
@@ -59,6 +59,7 protected:
59 59
60 60 public:
61 61 QAbstractAxis *q_ptr;
62 bool m_visible;
62 63
63 64 bool m_axisVisible;
64 65 QPen m_axisPen;
General Comments 0
You need to be logged in to leave comments. Login now