##// END OF EJS Templates
Fix pie chart label truncation...
Titta Heikkala -
r2646:a54f42bb13ad
parent child
Show More
@@ -135,7 +135,6 void PieSliceItem::updateGeometry()
135 135
136 136 if (m_data.m_isLabelVisible) {
137 137 // text rect
138 QFontMetricsF fm(m_data.m_labelFont);
139 138 m_labelTextRect = ChartPresenter::textBoundingRect(m_data.m_labelFont,
140 139 m_data.m_labelText,
141 140 0);
@@ -162,16 +161,14 void PieSliceItem::updateGeometry()
162 161 if (m_labelTextRect.right() > parentItem()->boundingRect().right())
163 162 m_labelTextRect.setRight(parentItem()->boundingRect().right());
164 163
165 if (fm.width(m_data.m_labelText) > m_labelTextRect.width()) {
166 label = ChartPresenter::truncatedText(m_data.m_labelFont, m_data.m_labelText,
167 qreal(0.0), m_labelTextRect.width(),
168 m_labelTextRect.height(), m_labelTextRect);
169 m_labelArmPath = labelArmPath(armStart, centerAngle,
170 m_data.m_radius * m_data.m_labelArmLengthFactor,
171 m_labelTextRect.width(), &labelTextStart);
164 label = ChartPresenter::truncatedText(m_data.m_labelFont, m_data.m_labelText,
165 qreal(0.0), m_labelTextRect.width(),
166 m_labelTextRect.height(), m_labelTextRect);
167 m_labelArmPath = labelArmPath(armStart, centerAngle,
168 m_data.m_radius * m_data.m_labelArmLengthFactor,
169 m_labelTextRect.width(), &labelTextStart);
170 m_labelTextRect.moveBottomLeft(labelTextStart);
172 171
173 m_labelTextRect.moveBottomLeft(labelTextStart);
174 }
175 172 m_labelItem->setTextWidth(m_labelTextRect.width()
176 173 + m_labelItem->document()->documentMargin());
177 174 m_labelItem->setHtml(label);
@@ -193,7 +190,7 void PieSliceItem::updateGeometry()
193 190 textCenter = m_data.m_center + offset(centerAngle, m_data.m_radius / 2);
194 191 }
195 192 m_labelItem->setPos(textCenter.x() - m_labelItem->boundingRect().width() / 2,
196 textCenter.y() - fm.height() / 2);
193 textCenter.y() - m_labelTextRect.height() / 2);
197 194
198 195 QPointF labelCenter = m_labelItem->boundingRect().center();
199 196 m_labelItem->setTransformOriginPoint(labelCenter);
General Comments 0
You need to be logged in to leave comments. Login now