ViewportScaleBar
The scale bar of the viewport, as an FEA solver draws one (owner feedback 2026-10-19, row 6.3).
| Inherits | QWidget |
In the namespace construct::ui. Declared in src/libs/libconstruct/construct/ui/ViewportScaleBar.hpp.
Detailed description
A horizontal bar of alternating dark and light segments, a label under each segment end, and the scene's display unit above the bar, flush with its right end, for example "mm" over "0.000 2.000 4.000 6.000 8.000" (the owner's sketch, 2026-10-21). The bar measures the world at the camera's target: scalebar::worldPerPixel() gives the size of one logical pixel there, and scalebar::choose() gives a length of 1, 2 or 5 × 10^n display units near targetPixels(), in 4 or 5 segments.
The widget only draws. The shell gives it the scale when the camera moves or the viewport resizes, and places it with the corner HUD in one function, corneroverlays::place(), left of the HUD rows on its band.
A thin light halo around the bar and a dark halo around the text keep it readable on a light and on a dark scene. Every size comes from the font, so the bar follows the font and the screen's scale. It takes the hover for its tooltip, which says where it measures (plan row 8.20): exact everywhere in orthographic; in perspective at the camera's target, or at the surface under the cursor while the cursor is over an item.