qt5base-lts/tests/auto/widgets
Volker Hilsheimer 33f9591e37 Implement missing support for 'em' and 'ex' lengths in style sheet
The Qt style sheet reference claimed that Length properties can be
specified in 'em' or 'ex' units, but that was never implemented.

Add the missing implementation. Since the sizes depend on the size of
the font of the current element, we cannot convert the units in the CSS
parser, but have to do so in the QRenderRule constructor, where we can
make a decision about which font to use if the style sheet itself doesn't
specify a font. Fall back to the widget font if possible; otherwise it
will be the application default font.

The implementation translates em into QFontMetrics.height, identical to
what is already done in the QCssParser. This is in line with the CSS
specification, but contradicts our previous documentation which stated
that 'em' means "width of M". Fix the documentation.

Fixes: QTBUG-8096
Pick-to: 6.2
Change-Id: I145e2504ae3b19101a0d0dd63653466b6c2cec1d
Done-with: Cristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-10 19:43:02 +02:00
..
dialogs testlib: Deprecate QWARN() in favor of qWarning() 2021-08-04 19:31:51 +02:00
effects Fix tst_qgraphicseffect on Wayland 2021-03-11 08:04:21 +01:00
graphicsview testlib: Deprecate QWARN() in favor of qWarning() 2021-08-04 19:31:51 +02:00
itemviews QListView: fix AdjustToContents (sizeAdjustPolicy) 2021-08-10 12:00:13 +02:00
kernel QWidget: cope with QObject::connect()'s incomplete SFINAE-friendliness 2021-07-24 00:33:09 +02:00
styles Implement missing support for 'em' and 'ex' lengths in style sheet 2021-08-10 19:43:02 +02:00
util Fix auto completion in QFileDialog on Windows 2021-07-09 00:48:44 +02:00
widgets testlib: Deprecate QWARN() in favor of qWarning() 2021-08-04 19:31:51 +02:00
CMakeLists.txt