From c23615f6e192c34f22c1e21dbf737c714c2cf9ce 2013-10-11 04:43:10 From: Titta Heikkala Date: 2013-10-11 04:43:10 Subject: [PATCH] Fix pie slice label visibility and position on change Fixed the visibility of pie slice label when it's change. Also fixed the position of label when changed to horizontal. Task-number: QTRD-2186 Change-Id: I5697be28a99c7c7844b59b7a7059d9a4e131747a Reviewed-by: Miikka Heikkinen --- diff --git a/src/piechart/piesliceitem.cpp b/src/piechart/piesliceitem.cpp index 8722bf9..942b711 100644 --- a/src/piechart/piesliceitem.cpp +++ b/src/piechart/piesliceitem.cpp @@ -131,6 +131,8 @@ void PieSliceItem::updateGeometry() QPointF armStart; m_slicePath = slicePath(m_data.m_center, m_data.m_radius, m_data.m_startAngle, m_data.m_angleSpan, ¢erAngle, &armStart); + m_labelItem->setVisible(m_data.m_isLabelVisible); + if (m_data.m_isLabelVisible) { // text rect QFontMetricsF fm(m_data.m_labelFont); @@ -139,7 +141,6 @@ void PieSliceItem::updateGeometry() 0); QString label(m_data.m_labelText); - m_labelItem->setVisible(m_data.m_isLabelVisible); m_labelItem->setDefaultTextColor(m_data.m_labelBrush.color()); m_labelItem->setFont(m_data.m_labelFont); @@ -203,6 +204,8 @@ void PieSliceItem::updateGeometry() m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2 - 90); else m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2 + 90); + } else { + m_labelItem->setRotation(0); } } }