##// END OF EJS Templates
fixes legend not vibile after showEvent
Michal Klocek -
r2082:786b61dc6f56
parent child
Show More
@@ -91,15 +91,14 void LegendLayout::setGeometry(const QRectF& rect)
91 {
91 {
92 m_legend->d_ptr->items()->setVisible(m_legend->isVisible());
92 m_legend->d_ptr->items()->setVisible(m_legend->isVisible());
93
93
94 if(m_legend->isAttachedToChart()) {
94 QGraphicsLayout::setGeometry(rect);
95
95
96 if(m_legend->isAttachedToChart()) {
96 setAttachedGeometry(rect);
97 setAttachedGeometry(rect);
97 }
98 } else {
98 else {
99 setDettachedGeometry(rect);
99 setDettachedGeometry(rect);
100 }
100 }
101
101
102 QGraphicsLayout::setGeometry(rect);
103 }
102 }
104
103
105 void LegendLayout::setAttachedGeometry(const QRectF& rect)
104 void LegendLayout::setAttachedGeometry(const QRectF& rect)
@@ -336,7 +336,6 void QLegend::setAlignment(Qt::Alignment alignment)
336 {
336 {
337 if(d_ptr->m_alignment!=alignment) {
337 if(d_ptr->m_alignment!=alignment) {
338 d_ptr->m_alignment = alignment;
338 d_ptr->m_alignment = alignment;
339 updateGeometry();
340 if(isAttachedToChart()){
339 if(isAttachedToChart()){
341 d_ptr->m_presenter->layout()->invalidate();
340 d_ptr->m_presenter->layout()->invalidate();
342 }else{
341 }else{
@@ -404,7 +403,7 bool QLegend::isBackgroundVisible() const
404 */
403 */
405 void QLegend::hideEvent(QHideEvent *event)
404 void QLegend::hideEvent(QHideEvent *event)
406 {
405 {
407 d_ptr->m_presenter->layout()->invalidate();
406 if(isAttachedToChart()) d_ptr->m_presenter->layout()->invalidate();
408 QGraphicsWidget::hideEvent(event);
407 QGraphicsWidget::hideEvent(event);
409 }
408 }
410
409
@@ -413,9 +412,12 void QLegend::hideEvent(QHideEvent *event)
413 */
412 */
414 void QLegend::showEvent(QShowEvent *event)
413 void QLegend::showEvent(QShowEvent *event)
415 {
414 {
415 if(isAttachedToChart()) {
416 d_ptr->m_presenter->layout()->invalidate();
417 d_ptr->items()->setVisible(false);
418 layout()->invalidate();
419 }
416 QGraphicsWidget::showEvent(event);
420 QGraphicsWidget::showEvent(event);
417 d_ptr->m_presenter->layout()->invalidate();
418 d_ptr->items()->setVisible(false);
419 //layout activation will show the items
421 //layout activation will show the items
420 }
422 }
421
423
General Comments 0
You need to be logged in to leave comments. Login now