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:
+2
-2
@@ -80,8 +80,8 @@ bool NetHackQtStringRequestor::Get(char *buffer, int maxchar, int minchar)
|
||||
input.setMaxLength(maxchar - 1);
|
||||
|
||||
const QString &txt = prompt.text();
|
||||
int pw = fontMetrics().width(txt),
|
||||
ww = minchar * input.fontMetrics().width(QChar('X'));
|
||||
int pw = fontMetrics().horizontalAdvance(txt),
|
||||
ww = minchar * input.fontMetrics().horizontalAdvance(QChar('X'));
|
||||
int heightfactor = ((txt.size() > 16) ? 3 : 2) * 2; // 2 or 3 lines high
|
||||
int widthfudge = (((txt.size() > 16) ? 1 : 2) * 5) * 2; // 5: margn, guttr
|
||||
resize(pw + ww + widthfudge, fontMetrics().height() * heightfactor);
|
||||
|
||||
Reference in New Issue
Block a user