- Positioning was calculated using `boundingRect` while `transformOriginPoint` was set according to `tightBoundingRect`, causing mismatch when `QGIDatumLabel` contains more than text (eg. shapes around text). Now `transformOriginPoint` and positioning calculated according to `tightBoundingRect`, and setting `transformOriginPoint` of `QGIDatumLabel` are handled by itself. This fixes an issue where the gap between dimension lines and text varied depending on dimension's angle.
- `m_lineWidth` was set in multiple locations, causing confusion and bug introduction
- If `X` or `Y` property changed, the remaining changed properties were not handled due to using `if else` rather than `if` for property change checking. This became an issue due the above mentioned simplification of `m_lineWidth` setting: if `X` or `Y` had changed (upon document restore).
- Center position was uneededly saved in variables `posX` and `posY` when it could be calculated on demand using `tightBoundingRect`. Removing this uneeded state simplfies code and lowers the risk of bug introduction due to lack of updating state.
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
* Remove magic number and hard type enums in LineNameEnum.h
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
* Remove magic number and hard type enums in QGIFace.h
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
* Remove magic number and hard type enums in Enums.h
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
* Remove magic number and hard type enums in QGVPage.h
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
* Remove magic number and hard type enums in TaskSurfaceFinishSymbols.h
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
* Remove magic number and hard type enums in QGTracker.h
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
Every basic data type is stored in Base module, color is standing out as
one that does not. Moving it to Base opens possibilities to integrate it
better with the rest of FreeCAD.
- Remove currently present magic numbers
- Hard type enums, so magic numbers can no longer be introduced. We don't want people to introduce magic numbers.
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
- additional geometry types
- add method to handle line like bsplines
- handle deleted ref body feature
- add test for empty savedGeometry
- add switch for matcher/LTNP on/off
- left justify tolerances
- use format spec for tolerance == zero
- prevent uncommanded tolerance format changes
- use 'w' format for HoleShaftFit
- allow zero tolerance values for HoleShaftFit