diff options
| author | Elvis Angelaccio <[email protected]> | 2020-05-28 22:40:57 +0200 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2020-05-29 23:23:55 +0000 |
| commit | b65576a131eb59eaab4d33af830bdb2d2f9fde9f (patch) | |
| tree | 099c4b343ec5519fffa733ecebedf34ba723c8ca /src/dolphinrecenttabsmenu.cpp | |
| parent | 7df39255a6a019d98e240261661c70866ce25151 (diff) | |
Port away from deprecated QFontMetrics::width()
While the documention says to port to QFontMetrics::horizontalAdvance(),
what we actually need is not the horizontal advance, but the width of
the text. So we need to port to QFontMetrics::boundingRect().width().
Quoting from https://kdepepo.wordpress.com/2019/08/05/about-deprecation-of-qfontmetricswidth/:
"Since it was not clear from the confusingly named function QFontMetrics::width()
that it actually returned the horizontal advance, instead of the bounding width,
this method is now obsolete.
You must port to either QFontMetrics::horizontalAdvance() or QFontMetrics::boundingRect().width().
Please make sure you are aware of the difference, and do not port
blindly. I am pretty sure that in most cases
QFontMetrics::boundingRect() is what you want, unless you are writing
custom text shaping/layouting code. Using the wrong function can cause
clipped text or text that suddenly wraps to the next line despite
calculating the width that it needs."
Diffstat (limited to 'src/dolphinrecenttabsmenu.cpp')
0 files changed, 0 insertions, 0 deletions
