From accd4ca3985475d308831ada3192818ade1bbba6 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 9 Feb 2022 01:30:02 +0600 Subject: [PATCH 1/2] qt: Scale statusbar icons based on DPI --- src/qt/qt_machinestatus.cpp | 3 ++- src/qt/qt_mainwindow.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index 47274994a..a604afd50 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -145,7 +145,7 @@ namespace { } }; - static const QSize pixmap_size(16, 16); + static QSize pixmap_size(16, 16); static const QString pixmap_empty = QStringLiteral("_empty"); static const QString pixmap_active = QStringLiteral("_active"); static const QString pixmap_empty_active = QStringLiteral("_empty_active"); @@ -171,6 +171,7 @@ struct MachineStatus::States { Pixmaps pixmaps; States(QObject* parent) { + pixmap_size = QSize(16, 16) * qobject_cast(parent->parent())->screen()->devicePixelRatio(); pixmaps.cartridge.load("/cartridge%1.ico"); pixmaps.cassette.load("/cassette%1.ico"); pixmaps.floppy_disabled.normal = ProgSettings::loadIcon(QStringLiteral("/floppy_disabled.ico")).pixmap(pixmap_size); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index ea3942958..cd9562de9 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -417,6 +417,7 @@ MainWindow::MainWindow(QWidget *parent) : #endif ui->toolBar->setIconSize(QSize(16 * screen()->devicePixelRatio(), 16 * screen()->devicePixelRatio())); + ui->statusbar->resize(ui->statusbar->width(), ui->statusbar->sizeHint().height() * screen()->devicePixelRatio()); } void MainWindow::closeEvent(QCloseEvent *event) { From 3f1d638a46092048732babd118310ba1953cafc1 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 9 Feb 2022 01:37:43 +0600 Subject: [PATCH 2/2] qt: Scale toolbar/statusbar icons only on Windows --- src/qt/qt_mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index cd9562de9..9d4004102 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -416,8 +416,10 @@ MainWindow::MainWindow(QWidget *parent) : } #endif +#ifdef _WIN32 ui->toolBar->setIconSize(QSize(16 * screen()->devicePixelRatio(), 16 * screen()->devicePixelRatio())); ui->statusbar->resize(ui->statusbar->width(), ui->statusbar->sizeHint().height() * screen()->devicePixelRatio()); +#endif } void MainWindow::closeEvent(QCloseEvent *event) {