@@ -91,15 +91,14 void LegendLayout::setGeometry(const QRectF& rect) | |||
|
91 | 91 | { |
|
92 | 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 | 97 | setAttachedGeometry(rect); |
|
97 | } | |
|
98 | else { | |
|
98 | } else { | |
|
99 | 99 | setDettachedGeometry(rect); |
|
100 | 100 | } |
|
101 | 101 | |
|
102 | QGraphicsLayout::setGeometry(rect); | |
|
103 | 102 | } |
|
104 | 103 | |
|
105 | 104 | void LegendLayout::setAttachedGeometry(const QRectF& rect) |
@@ -336,7 +336,6 void QLegend::setAlignment(Qt::Alignment alignment) | |||
|
336 | 336 | { |
|
337 | 337 | if(d_ptr->m_alignment!=alignment) { |
|
338 | 338 | d_ptr->m_alignment = alignment; |
|
339 | updateGeometry(); | |
|
340 | 339 | if(isAttachedToChart()){ |
|
341 | 340 | d_ptr->m_presenter->layout()->invalidate(); |
|
342 | 341 | }else{ |
@@ -404,7 +403,7 bool QLegend::isBackgroundVisible() const | |||
|
404 | 403 | */ |
|
405 | 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 | 407 | QGraphicsWidget::hideEvent(event); |
|
409 | 408 | } |
|
410 | 409 | |
@@ -413,9 +412,12 void QLegend::hideEvent(QHideEvent *event) | |||
|
413 | 412 | */ |
|
414 | 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 | 420 | QGraphicsWidget::showEvent(event); |
|
417 | d_ptr->m_presenter->layout()->invalidate(); | |
|
418 | d_ptr->items()->setVisible(false); | |
|
419 | 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