From c44a116d4ae8fc3f2f2ddd320e1fd480c026c65b 2013-03-21 13:23:20 From: Miikka Heikkinen Date: 2013-03-21 13:23:20 Subject: [PATCH] Adjust pie slice bounding rectangle to account for thick pens Task-number: QTRD-1937 Reviewed-by: Mika Salmela --- diff --git a/src/piechart/piesliceitem.cpp b/src/piechart/piesliceitem.cpp index 6ec66ea..8d7a579 100644 --- a/src/piechart/piesliceitem.cpp +++ b/src/piechart/piesliceitem.cpp @@ -192,6 +192,11 @@ void PieSliceItem::updateGeometry() m_boundingRect = m_slicePath.boundingRect().united(m_labelArmPath.boundingRect()).united(m_labelTextRect); else m_boundingRect = m_slicePath.boundingRect(); + + // Inflate bounding rect by 2/3 pen width to make sure it encompasses whole slice also for thick pens + // and miter joins. + int penWidth = (m_data.m_slicePen.width() * 2) / 3; + m_boundingRect = m_boundingRect.adjusted(-penWidth, -penWidth, penWidth, penWidth); } QPointF PieSliceItem::sliceCenter(QPointF point, qreal radius, QPieSlice *slice)