Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.1
-
None
Description
If I use font metrics to calculate the required width for text, the resulting width is depending on font, font size and platform not sufficient to avoid eliding as it seems to round the result down. The example below gives me 234 and 234.016 (Ubuntu Linux). If I use the latter with ceil everything is fine. If I use the former the text is being elided.
QFont font("Arial", 20); QString text("Dies ist ein test text"); const QFontMetrics fm(font); qDebug() << fm.elidedText( text, Qt::ElideRight, fm.horizontalAdvance(text) ); const QFontMetricsF fmf(font); qDebug() << fmf.elidedText( text, Qt::ElideRight, fmf.horizontalAdvance(text) );
Attachments
For Gerrit Dashboard: QTBUG-90036 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
431455,2 | doc: Clarify the term advance width | dev | qt/qtbase | Status: MERGED | +2 | 0 |