Changes to accommodate for high DPI

Not sure how this will work on Linux or macOS.
This commit is contained in:
Pengfei
2021-06-27 18:46:08 +08:00
parent 412aeaa0d4
commit 3db1c43fd6
8 changed files with 25 additions and 21 deletions
+4
View File
@@ -5,6 +5,7 @@
#include <regex>
#include <string>
#include <QApplication>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QMessageBox>
#include <QStorageInfo>
@@ -38,6 +39,9 @@ bool IsConfigGood(const Core::Config& config) {
MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<Ui::MainDialog>()) {
ui->setupUi(this);
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh"));