Qt: Fix Qt5 deprecation warnings

Mostly the warnings were about QString::sprintf and QFontMetrics::width.
sprintf replacement is asprintf, which annoyingly behaves differently
from sprintf - it seems to append to the string.

Not thoroughly tested, but seems to work.
This commit is contained in:
Pasi Kallinen
2021-08-14 21:03:13 +03:00
parent 1b3b7b0b29
commit 6554500593
13 changed files with 42 additions and 47 deletions

View File

@@ -145,7 +145,7 @@ void NetHackQtMapViewport::SetupTextmapFont(QPainter &painter)
QFont f(fontfamily, pts, maybebold);
painter.setFont(QFont(fontfamily, pts));
QFontMetrics fm = painter.fontMetrics();
if (fm.width("M") > qt_settings->glyphs().width())
if (fm.horizontalAdvance("M") > qt_settings->glyphs().width())
break;
if (fm.height() > qt_settings->glyphs().height())
break;