From 5ab965588b064f758049c3aea7e32899fb0db3f9 Mon Sep 17 00:00:00 2001 From: blacksun Date: Sun, 7 Dec 2014 15:47:58 +0000 Subject: [PATCH] Fix artefact on qgraphics scene when remove a linked element git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3534 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/commentitem.cpp | 1 + sources/qetgraphicsitem/crossrefitem.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sources/qetgraphicsitem/commentitem.cpp b/sources/qetgraphicsitem/commentitem.cpp index 4c4b9baab..c27935b07 100644 --- a/sources/qetgraphicsitem/commentitem.cpp +++ b/sources/qetgraphicsitem/commentitem.cpp @@ -129,6 +129,7 @@ void CommentItem::updateLabel() { text_bounding.adjust(-1,0,1,0); //adjust only for better visual painter.drawRoundedRect(text_bounding, 2, 2); + prepareGeometryChange(); m_bounding_rect = text_bounding; } diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index cd09306de..c1a6f704f 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -157,11 +157,12 @@ void CrossRefItem::updateProperties() { * Update the content of the item */ void CrossRefItem::updateLabel() { - //init the shape and bounding rect + //init the shape and bounding rect m_shape_path = QPainterPath(); + prepareGeometryChange(); m_bounding_rect = QRectF(); - //init the painter + //init the painter QPainter qp; qp.begin(&m_drawing); QPen pen_; @@ -169,7 +170,7 @@ void CrossRefItem::updateLabel() { qp.setPen(pen_); qp.setFont(QETApp::diagramTextsFont(5)); - //Draw cross or contact, only if master element is linked. + //Draw cross or contact, only if master element is linked. if (! m_element->linkedElements().isEmpty()) { XRefProperties::DisplayHas dh = m_properties.displayHas(); @@ -183,7 +184,6 @@ void CrossRefItem::updateLabel() { qp.end(); autoPos(); - update(); checkMustShow(); } @@ -303,6 +303,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) { } m_shape_path.addRect(default_bounding); + prepareGeometryChange(); m_bounding_rect = default_bounding; } @@ -361,6 +362,7 @@ void CrossRefItem::drawHasContacts(QPainter &painter) { } QRectF br(0, 0, 50, m_drawed_contacts*10+4); + prepareGeometryChange(); m_bounding_rect = br; m_shape_path.addRect(br); } @@ -518,6 +520,7 @@ void CrossRefItem::AddExtraInfo(QPainter &painter) { text_bounding.adjust(-1,0,1,0); //adjust only for better visual m_shape_path.addRect(text_bounding); + prepareGeometryChange(); m_bounding_rect = m_bounding_rect.united(text_bounding); painter.drawRoundedRect(text_bounding, 2, 2); painter.restore();