Skip to content

Commit

Permalink
[TD]fix RTA bounding rect
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan authored and adrianinsaval committed Dec 4, 2023
1 parent 6e09b17 commit 7d750ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mod/TechDraw/Gui/QGIRichAnno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,16 @@ TechDraw::DrawRichAnno* QGIRichAnno::getFeature()
// TODO: this rect is the right size, but not in the right place
QRectF QGIRichAnno::boundingRect() const
{
return m_text->boundingRect() | m_rect->boundingRect();
QRectF roughRect = m_text->boundingRect() | m_rect->boundingRect();
double halfWidth = roughRect.width() / 2.0;
double halfHeight = roughRect.height() / 2.0;
return { -halfWidth, - halfHeight, halfWidth * 2.0, halfHeight * 2.0 };
}

void QGIRichAnno::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;

// painter->setPen(Qt::blue);
// painter->drawRect(boundingRect()); //good for debugging

Expand Down

0 comments on commit 7d750ab

Please sign in to comment.