##// END OF EJS Templates
changed legend default visibility
sauimone -
r882:703758f6d2cf
parent child
Show More
@@ -100,10 +100,11 QLegend::QLegend(QChart *chart):QGraphicsWidget(chart),
100 100 m_minHeight(0),
101 101 m_width(0),
102 102 m_height(0),
103 m_visible(false)
103 m_backgroundVisible(false)
104 104 {
105 105 setZValue(ChartPresenter::LegendZValue);
106 106 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
107 setVisible(false); // By default legend is invisible
107 108 }
108 109
109 110 /*!
@@ -114,7 +115,7 void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
114 115 {
115 116 Q_UNUSED(option)
116 117 Q_UNUSED(widget)
117 if(!m_visible) return;
118 if(!m_backgroundVisible) return;
118 119
119 120 painter->setOpacity(opacity());
120 121 painter->setPen(m_pen);
@@ -482,16 +483,16 void QLegend::updateLayout()
482 483
483 484 void QLegend::setBackgroundVisible(bool visible)
484 485 {
485 if(m_visible!=visible)
486 if(m_backgroundVisible!=visible)
486 487 {
487 m_visible=visible;
488 m_backgroundVisible=visible;
488 489 update();
489 490 }
490 491 }
491 492
492 493 bool QLegend::isBackgroundVisible() const
493 494 {
494 return m_visible;
495 return m_backgroundVisible;
495 496 }
496 497
497 498 void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event)
@@ -80,7 +80,7 public:
80 80 qreal minWidht() const { return m_minWidth;}
81 81 qreal minHeight() const { return m_minHeight;}
82 82
83 void setBackgroundVisible(bool visible);
83 void setBackgroundVisible(bool visible = true);
84 84 bool isBackgroundVisible() const;
85 85
86 86 void setOffset(const QPointF& point);
@@ -130,7 +130,7 private:
130 130 qreal m_minHeight;
131 131 qreal m_width;
132 132 qreal m_height;
133 bool m_visible;
133 bool m_backgroundVisible;
134 134 friend class ScrolledQLegend;
135 135 // <--- PIMPL
136 136 };
General Comments 0
You need to be logged in to leave comments. Login now