TechDraw: Fix dimension alignment issue.
Fixes issue #19121 "dimension numbers placed lower than normal". Problem: QGCustomText has a new method `alignmentRect` which can optionally return a `tightBoundingRect` instead of the regular `boundingRect`. The `alignmentRect` is used for laying out the `QGIDatumLabel`, however QGraphicsItemGroup's `childrenBoundingRect` use the childrens' `boundingRect` and knows nothing of `alignmentRect`. The result is an improperly sized label and frame and miss alignment. Additionally `childrenBoundingRect` calculations includes hidden views, so even though the `m_tolTextOver` and `m_tolTextUnder` are hidden they still affect the bounding rect size. Solution: 1. Implement new method `QGIDatumLabel::tightBoundingRect` this calculates the bounding rect using the subview's `aligmentRect` if there is text in the custom text. 2. Use `tightBoundingRect` in place of `boundingRect` to for the drawing of arrows and the exact dim frames. 3. This PR acknowledges that there are some edge case fonts that while not clipped may not interface perfectly with arrows and the exact dimension frame. 4. Fix vertical alignment of `m_tolTextOver` / `m_tolTextUnder` 5. Incorporate PR Review comments
This commit is contained in:
committed by
Max Wilfinger
parent
11125be89d
commit
9990408035
@@ -178,7 +178,7 @@ void QGCustomText::paint ( QPainter * painter, const QStyleOptionGraphicsItem *
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->setPen(Qt::green);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
// painter->drawRect(alignmentRect()); //good for debugging
|
||||
|
||||
QGraphicsTextItem::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user