Merge pull request #2072 from Cacodemon345/newqt

qt: Scale statusbar icons based on DPI
This commit is contained in:
Miran Grča
2022-02-08 20:49:32 +01:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -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<MainWindow*>(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);

View File

@@ -416,7 +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) {