Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.12.2
-
None
Description
Qt currently supports only 'px' and 'pt' values for font-size Style Sheets parameter.
This is very inconvenient for application development, when app should look similar in multiple environments with different screen resolutions, different pixel sizes of system font and different px/pt ratio.
Please find below code proposal to add this support in qcssparser.cpp, setFontSizeFromValue() func, at line 1128:
else if (s.endsWith(QLatin1String("em"), Qt::CaseInsensitive)) { s.chop(2); value.variant = s; if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) { font->setPixelSize(qRound(QFontMetrics(QFont()).height() * value.variant.toReal())); valid = true; } }
Proposed approach is similar to what already used in CSS parser in lengthValueFromData function.
Am I miss why 'em' is still not supported for font size in Qt?