From ee3db24c994309a595896cfe6c2f43f160ad17ce Mon Sep 17 00:00:00 2001 From: Xu Yanghe Date: Wed, 19 Aug 2020 11:14:06 +0800 Subject: Check anchor before painting callout QChart::mapToPosition return QPointF including decimal, like QPointF(-0.0265625,542.875).Then anchor became wrong,and paint callout in left bottom corner. Judge m_anchor before paint callout.If m_anchor is null, discarding painting callout. Fixes: QTBUG-86036 Change-Id: I09246195c5ffe37573464d6a4f68cb7ea06c21f6 Reviewed-by: Miikka Heikkinen --- examples/charts/callout/callout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/charts') diff --git a/examples/charts/callout/callout.cpp b/examples/charts/callout/callout.cpp index c78693b6..d6e3efad 100644 --- a/examples/charts/callout/callout.cpp +++ b/examples/charts/callout/callout.cpp @@ -59,7 +59,7 @@ void Callout::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q path.addRoundedRect(m_rect, 5, 5); QPointF anchor = mapFromParent(m_chart->mapToPosition(m_anchor)); - if (!m_rect.contains(anchor)) { + if (!m_rect.contains(anchor) && !m_anchor.isNull()) { QPointF point1, point2; // establish the position of the anchor point in relation to m_rect -- cgit v1.2.3