##// END OF EJS Templates
Fixes blinking and minimal false size for legend
Michal Klocek -
r1538:8f0be28e5215
parent child
Show More
@@ -21,6 +21,7
21 21 #include "chartlayout_p.h"
22 22 #include "chartpresenter_p.h"
23 23 #include "chartaxis_p.h"
24 #include <QDebug>
24 25
25 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 27
@@ -41,6 +42,7 ChartLayout::~ChartLayout()
41 42
42 43 void ChartLayout::setGeometry(const QRectF& rect)
43 44 {
45
44 46 if (!rect.isValid()) return;
45 47
46 48 QGraphicsLayout::setGeometry(rect);
@@ -22,6 +22,7
22 22 #include "chartpresenter_p.h"
23 23 #include "legendmarker_p.h"
24 24 #include "qlegend_p.h"
25 #include <QDebug>
25 26
26 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 28
@@ -85,7 +86,6 QPointF LegendLayout::offset() const
85 86
86 87 void LegendLayout::setGeometry(const QRectF& rect)
87 88 {
88 if (!rect.isValid()) return;
89 89
90 90 QGraphicsLayout::setGeometry(rect);
91 91
@@ -99,6 +99,7 void LegendLayout::setGeometry(const QRectF& rect)
99 99
100 100 void LegendLayout::setAttachedGeometry(const QRectF& rect)
101 101 {
102 if (!rect.isValid()) return;
102 103
103 104 m_offsetX=0;
104 105 m_offsetY=0;
@@ -170,6 +171,8 void LegendLayout::setAttachedGeometry(const QRectF& rect)
170 171
171 172 void LegendLayout::setDettachedGeometry(const QRectF& rect)
172 173 {
174 if (!rect.isValid()) return;
175
173 176 // Detached layout is different.
174 177 // In detached mode legend may have multiple rows and columns, so layout calculations
175 178 // differ a log from attached mode.
@@ -335,6 +338,8 QSizeF LegendLayout::sizeHint ( Qt::SizeHint which, const QSizeF & constraint) c
335 338 qreal left, top, right, bottom;
336 339 getContentsMargins(&left, &top, &right, &bottom);
337 340
341 if(which!=Qt::PreferredSize) return QSizeF(-1,-1);
342
338 343 if(constraint.isValid()) {
339 344 foreach(LegendMarker* marker, m_legend->d_ptr->markers()) {
340 345 size = size.expandedTo(marker->effectiveSizeHint(which));
@@ -366,7 +371,10 QSizeF LegendLayout::sizeHint ( Qt::SizeHint which, const QSizeF & constraint) c
366 371 }
367 372 }
368 373 size += QSize(left + right, top + bottom);
374
369 375 return size;
376
377
370 378 }
371 379
372 380 QTCOMMERCIALCHART_END_NAMESPACE
@@ -492,6 +492,7 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain)
492 492 }
493 493
494 494 q_ptr->layout()->invalidate();
495 q_ptr->layout()->activate();
495 496 }
496 497
497 498 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series)
General Comments 0
You need to be logged in to leave comments. Login now