From 5086492877e0de885ac81c1e9bc151cf796999b6 2013-11-04 09:27:08 From: Titta Heikkala Date: 2013-11-04 09:27:08 Subject: [PATCH] Fix pie slice label visibility Hide the pie slice label if it's not inside the bounding rectangle of the parent item. Task-number: QTRD-2530 Change-Id: Ifa09f7ee9e35c301f3abfd3ddab1ac3a4545af3e Reviewed-by: Miikka Heikkinen --- diff --git a/src/piechart/piesliceitem.cpp b/src/piechart/piesliceitem.cpp index 3b5bed7..b549784 100644 --- a/src/piechart/piesliceitem.cpp +++ b/src/piechart/piesliceitem.cpp @@ -206,6 +206,13 @@ void PieSliceItem::updateGeometry() m_labelItem->setRotation(0); } } + // Hide label if it's outside the bounding rect of parent item + QRectF labelRect(m_labelItem->boundingRect()); + labelRect.moveTopLeft(m_labelItem->pos()); + if (parentItem()->boundingRect().contains(labelRect)) + m_labelItem->show(); + else + m_labelItem->hide(); } // bounding rect