- 
    
Bug
 - 
    Resolution: Done
 - 
    
P3: Somewhat important
 - 
    5.12.5, 5.13.0, 5.13.1
 - 
    None
 
- 
        4a240bb67e72b34c80af448e0a74846609fa6975 (qt/qtbase/5.14)
 
QTextDocument has no concept of units. So values given for margins, paddings or border width have to be provided in pixels. Internally QTextDocument uses qt_defaultDpi and the QPaintDevice's dpi metrics to calculate a scale factor (see internal QTextDocumentLayout::scaleToDevice method).
So in order to apply e.g. metric values, one has to calculate a pixel value based on qt_defaultDpi (which is more or less a private function, so you must use QGuiApplication::primaryScreen()->logicalDotsPerInchX() to get that value).
But while metrics like cellPadding are correctly scaled, some values in QTextFrameFormat are not:
- [top|left|right|bottom]Margin
 - padding
 - border
 
The attached example program tries to set the 'border' value. Attached are the results for on-screen rendering and printing.
A patch to fix this is being worked on.
- relates to
 - 
                    
QTBUG-74335 QML RichText table border is misaligned
-         
 - Closed
 
 -