Replace obsoleted QFontMetrics::width()

Qt 5.13 marked QFontMetrics::width() obsolete.
This commit is contained in:
Chocobo1 2019-07-01 14:34:02 +08:00
parent c0557c296a
commit 4eff268095
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 30 additions and 0 deletions

View file

@ -341,7 +341,11 @@ void showSplashScreen()
const QString version = QBT_VERSION;
painter.setPen(QPen(Qt::white));
painter.setFont(QFont("Arial", 22, QFont::Black));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
painter.drawText(224 - painter.fontMetrics().horizontalAdvance(version), 270, version);
#else
painter.drawText(224 - painter.fontMetrics().width(version), 270, version);
#endif
QSplashScreen *splash = new QSplashScreen(splashImg);
splash->show();
QTimer::singleShot(1500, splash, &QObject::deleteLater);