mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-08 23:31:03 +02:00
hiro/qt: QFontMetrics::width -> QFontMetrics::horizontalAdvance
QFontMetrics::width was deprecated in Qt 5.11 in favor of Qt QFontMetrics::horizontalAdvance. Because QFontMetrics::horizontalAdvance was introduced in Qt 5.11, it poses the most risk of breaking an existing user of almost any of the deprecation changes, but Qt 5.11 is fairly old by now (2018) and has been EOL for a while, so I still opted to just move to the new function rather than use a version guard.
This commit is contained in:
committed by
Screwtapello
parent
58694a2935
commit
fb09f52093
@@ -11,7 +11,7 @@ auto pFont::size(const QFont& qtFont, const string& text) -> Size {
|
||||
signed maxWidth = 0;
|
||||
auto lines = text.split("\n");
|
||||
for(auto& line : lines) {
|
||||
maxWidth = max(maxWidth, metrics.width(QString::fromUtf8(line)));
|
||||
maxWidth = max(maxWidth, metrics.horizontalAdvance(QString::fromUtf8(line)));
|
||||
}
|
||||
return {maxWidth, metrics.height() * (signed)lines.size()};
|
||||
}
|
||||
|
Reference in New Issue
Block a user