Fix HiDPI scaling setting

This commit is contained in:
Cacodemon345
2021-12-30 23:36:49 +06:00
parent b907b7bec4
commit 81a7107969

View File

@@ -32,6 +32,7 @@ extern "C" {
#include <QCheckBox> #include <QCheckBox>
#include <QActionGroup> #include <QActionGroup>
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QScreen>
#include <array> #include <array>
#include <unordered_map> #include <unordered_map>
@@ -116,8 +117,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) { connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
if (!QApplication::platformName().contains("eglfs") && vid_resize == 0) { if (!QApplication::platformName().contains("eglfs") && vid_resize == 0) {
w = w / (!dpi_scale ? devicePixelRatio() : 1); w = w / (!dpi_scale ? this->screen()->devicePixelRatio() : 1);
int modifiedHeight = (h / (!dpi_scale ? devicePixelRatio() : 1)) + menuBar()->height() + (statusBar()->height() * !hide_status_bar); int modifiedHeight = (h / (!dpi_scale ? this->screen()->devicePixelRatio() : 1)) + menuBar()->height() + (statusBar()->height() * !hide_status_bar);
ui->stackedWidget->resize(w, h); ui->stackedWidget->resize(w, h);
if (vid_resize == 0) { if (vid_resize == 0) {
setFixedSize(w, modifiedHeight); setFixedSize(w, modifiedHeight);