diff options
author | Xu Yanghe <xuyanghe@uniontech.com> | 2020-08-19 11:14:06 +0800 |
---|---|---|
committer | Xu Yanghe <xuyanghe@uniontech.com> | 2020-08-21 01:15:31 +0800 |
commit | ee3db24c994309a595896cfe6c2f43f160ad17ce (patch) | |
tree | 3acabfc948bd7b8076614c192f0e884074452ad8 /examples/charts/callout | |
parent | 0b7e79fc902a6c2efecc29c94622674f4c3e056d (diff) |
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 <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples/charts/callout')
-rw-r--r-- | examples/charts/callout/callout.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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 |