Migrate away from deprecated function

`QStyle::standardPixmap()` is deprecated.

PR #19660.
This commit is contained in:
Chocobo1 2023-09-30 11:43:11 +08:00 committed by GitHub
parent 47439a7efd
commit 0404ff9fb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -158,12 +158,14 @@ void StatusBar::showRestartRequired()
{ {
// Restart required notification // Restart required notification
const QString restartText = tr("qBittorrent needs to be restarted!"); const QString restartText = tr("qBittorrent needs to be restarted!");
QLabel *restartIconLbl = new QLabel(this);
restartIconLbl->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxWarning)); const QPixmap pixmap = style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(Utils::Gui::smallIconSize());
auto *restartIconLbl = new QLabel(this);
restartIconLbl->setPixmap(pixmap);
restartIconLbl->setToolTip(restartText); restartIconLbl->setToolTip(restartText);
insertWidget(0, restartIconLbl); insertWidget(0, restartIconLbl);
QLabel *restartLbl = new QLabel(this); auto *restartLbl = new QLabel(this);
restartLbl->setText(restartText); restartLbl->setText(restartText);
insertWidget(1, restartLbl); insertWidget(1, restartLbl);
} }

View file

@ -38,7 +38,7 @@ namespace BitTorrent
struct SessionStatus; struct SessionStatus;
} }
class StatusBar : public QStatusBar class StatusBar final : public QStatusBar
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY_MOVE(StatusBar) Q_DISABLE_COPY_MOVE(StatusBar)