##// END OF EJS Templates
fix to QTRD-1674: layout is not calculated correctly after the change in the text of legend marker
sauimone -
r2194:659ade794246
parent child
Show More
@@ -77,6 +77,7 void QAreaLegendMarkerPrivate::updated()
77 {
77 {
78 m_item->setBrush(m_series->brush());
78 m_item->setBrush(m_series->brush());
79 m_item->setLabel(m_series->name());
79 m_item->setLabel(m_series->name());
80 invalidateLegend();
80 }
81 }
81
82
82 #include "moc_qarealegendmarker.cpp"
83 #include "moc_qarealegendmarker.cpp"
@@ -86,6 +86,7 void QBarLegendMarkerPrivate::updated()
86 m_item->setPen(m_barset->pen());
86 m_item->setPen(m_barset->pen());
87 m_item->setBrush(m_barset->brush());
87 m_item->setBrush(m_barset->brush());
88 m_item->setLabel(m_barset->label());
88 m_item->setLabel(m_barset->label());
89 invalidateLegend();
89 }
90 }
90
91
91 #include "moc_qbarlegendmarker.cpp"
92 #include "moc_qbarlegendmarker.cpp"
@@ -102,6 +102,7 private:
102 friend class LegendLayout;
102 friend class LegendLayout;
103 friend class ChartLayout;
103 friend class ChartLayout;
104 friend class LegendMarkerItem;
104 friend class LegendMarkerItem;
105 friend class QLegendMarkerPrivate;
105 };
106 };
106
107
107 QTCOMMERCIALCHART_END_NAMESPACE
108 QTCOMMERCIALCHART_END_NAMESPACE
@@ -93,6 +93,7 private:
93 friend class QLegend;
93 friend class QLegend;
94 friend class LegendMarkerItem;
94 friend class LegendMarkerItem;
95 friend class LegendLayout;
95 friend class LegendLayout;
96 friend class QLegendMarkerPrivate;
96 };
97 };
97
98
98 QTCOMMERCIALCHART_END_NAMESPACE
99 QTCOMMERCIALCHART_END_NAMESPACE
@@ -22,6 +22,8
22 #include "qlegendmarker_p.h"
22 #include "qlegendmarker_p.h"
23 #include "legendmarkeritem_p.h"
23 #include "legendmarkeritem_p.h"
24 #include "qlegend.h"
24 #include "qlegend.h"
25 #include "qlegend_p.h"
26 #include "legendlayout_p.h"
25 #include <QFontMetrics>
27 #include <QFontMetrics>
26 #include <QGraphicsSceneEvent>
28 #include <QGraphicsSceneEvent>
27 #include <QAbstractSeries>
29 #include <QAbstractSeries>
@@ -112,6 +114,12 QLegendMarkerPrivate::~QLegendMarkerPrivate()
112 {
114 {
113 }
115 }
114
116
117 void QLegendMarkerPrivate::invalidateLegend()
118 {
119 m_legend->d_ptr->m_layout->invalidate();
120 }
121
122
115
123
116 #include "moc_qlegendmarker.cpp"
124 #include "moc_qlegendmarker.cpp"
117 #include "moc_qlegendmarker_p.cpp"
125 #include "moc_qlegendmarker_p.cpp"
@@ -65,8 +65,10 public:
65 virtual QAbstractSeries* series() = 0;
65 virtual QAbstractSeries* series() = 0;
66 virtual QObject* relatedObject() = 0;
66 virtual QObject* relatedObject() = 0;
67
67
68 void invalidateLegend();
69
68 public Q_SLOTS:
70 public Q_SLOTS:
69 virtual void updated() {};
71 virtual void updated() { invalidateLegend(); }
70
72
71 protected:
73 protected:
72 LegendMarkerItem *m_item;
74 LegendMarkerItem *m_item;
@@ -86,6 +86,7 void QPieLegendMarkerPrivate::updated()
86 m_item->setPen(m_slice->pen());
86 m_item->setPen(m_slice->pen());
87 m_item->setBrush(m_slice->brush());
87 m_item->setBrush(m_slice->brush());
88 m_item->setLabel(m_slice->label());
88 m_item->setLabel(m_slice->label());
89 invalidateLegend();
89 }
90 }
90
91
91 #include "moc_qpielegendmarker.cpp"
92 #include "moc_qpielegendmarker.cpp"
@@ -82,6 +82,7 void QXYLegendMarkerPrivate::updated()
82 } else {
82 } else {
83 m_item->setBrush(QBrush(m_series->pen().color()));
83 m_item->setBrush(QBrush(m_series->pen().color()));
84 }
84 }
85 invalidateLegend();
85 }
86 }
86
87
87 #include "moc_qxylegendmarker.cpp"
88 #include "moc_qxylegendmarker.cpp"
General Comments 0
You need to be logged in to leave comments. Login now