doc: Clarify usage of QFontMetricsF instead of QFontMetrics
A common source of issues is that people do not consider that fonts can have fractional metrics and use QFontMetrics for UI purposes, causing bounds and eliding to be inaccurate. This is not very surprising, since the class name sounds very much like what you should prefer by default and the docs didn't even contain links to the QFontMetricsF class. It might make sense to deprecate the class, since it really does not serve any useful purpose, but for now we at least document the issue up-front so that users can easily find the alternative. Pick-to: 6.5 6.8 6.9 Task-number: QTBUG-132102 Change-Id: I69756c561e5dee448a9d0a7d85af1a9b15ff1ae3 Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
1ab1070f21
commit
9a6036dea2
@ -31,8 +31,13 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
|
|||||||
\ingroup shared
|
\ingroup shared
|
||||||
|
|
||||||
QFontMetrics functions calculate the size of characters and
|
QFontMetrics functions calculate the size of characters and
|
||||||
strings for a given font. There are three ways you can create a
|
strings for a given font. The class is an integer-based version
|
||||||
QFontMetrics object:
|
of QFontMetricsF and will round all numbers to the nearest
|
||||||
|
integer. This means its results will be inaccurate for any font
|
||||||
|
with fractional metrics. In most cases QFontMetricsF should be
|
||||||
|
used instead.
|
||||||
|
|
||||||
|
There are three ways you can create a QFontMetrics object:
|
||||||
|
|
||||||
\list 1
|
\list 1
|
||||||
\li Calling the QFontMetrics constructor with a QFont creates a
|
\li Calling the QFontMetrics constructor with a QFont creates a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user