Fix compiler warning in gb.qt5 about deprecation of QFontMetrics::width()
QFontMetrics::width() is deprecated since Qt 5.11
This commit is contained in:
parent
3f099c9b83
commit
daf012a246
2 changed files with 8 additions and 0 deletions
|
@ -124,7 +124,11 @@ static int get_text_width(QPainter *dp, QString &s)
|
|||
|
||||
for (i = 0; i < (int)text_sl.count(); i++)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
w = dp->fontMetrics().horizontalAdvance(text_sl[i]);
|
||||
#else
|
||||
w = dp->fontMetrics().width(text_sl[i]);
|
||||
#endif
|
||||
if (w > width) width = w;
|
||||
text_w[i] = w;
|
||||
}
|
||||
|
|
|
@ -932,7 +932,11 @@ static int get_text_width(QPainter *dp, QString &s)
|
|||
|
||||
for (i = 0; i < (int)text_sl.count(); i++)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
||||
w = dp->fontMetrics().horizontalAdvance(text_sl[i]);
|
||||
#else
|
||||
w = dp->fontMetrics().width(text_sl[i]);
|
||||
#endif
|
||||
if (w > width) width = w;
|
||||
text_w[i] = w;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue