diff --git a/selfdrive/ui/installer/installer.cc b/selfdrive/ui/installer/installer.cc index 6ee6e99e0..5366a0eac 100644 --- a/selfdrive/ui/installer/installer.cc +++ b/selfdrive/ui/installer/installer.cc @@ -221,7 +221,7 @@ void Installer::cloneFinished(int exitCode, QProcess::ExitStatus exitStatus) { } int main(int argc, char *argv[]) { - initApp(); + initApp(argc, argv); QApplication a(argc, argv); Installer installer; setMainWindow(&installer); diff --git a/selfdrive/ui/main.cc b/selfdrive/ui/main.cc index 3d2411b9c..8477bc896 100644 --- a/selfdrive/ui/main.cc +++ b/selfdrive/ui/main.cc @@ -12,7 +12,7 @@ int main(int argc, char *argv[]) { setpriority(PRIO_PROCESS, 0, -20); qInstallMessageHandler(swagLogMessageHandler); - initApp(); + initApp(argc, argv); if (Hardware::EON()) { QSslConfiguration ssl = QSslConfiguration::defaultConfiguration(); diff --git a/selfdrive/ui/qt/setup/updater.cc b/selfdrive/ui/qt/setup/updater.cc index dfa63fca1..6345d80db 100644 --- a/selfdrive/ui/qt/setup/updater.cc +++ b/selfdrive/ui/qt/setup/updater.cc @@ -190,7 +190,7 @@ bool Updater::eventFilter(QObject *obj, QEvent *event) { } int main(int argc, char *argv[]) { - initApp(); + initApp(argc, argv); QApplication a(argc, argv); Updater updater(argv[1], argv[2]); setMainWindow(&updater); diff --git a/selfdrive/ui/qt/spinner.cc b/selfdrive/ui/qt/spinner.cc index b9868f603..e0b263227 100644 --- a/selfdrive/ui/qt/spinner.cc +++ b/selfdrive/ui/qt/spinner.cc @@ -111,7 +111,7 @@ void Spinner::update(int n) { } int main(int argc, char *argv[]) { - initApp(); + initApp(argc, argv); QApplication a(argc, argv); Spinner spinner; setMainWindow(&spinner); diff --git a/selfdrive/ui/qt/text.cc b/selfdrive/ui/qt/text.cc index cb69cc082..04fda3548 100644 --- a/selfdrive/ui/qt/text.cc +++ b/selfdrive/ui/qt/text.cc @@ -11,7 +11,7 @@ #include "selfdrive/ui/qt/widgets/scrollview.h" int main(int argc, char *argv[]) { - initApp(); + initApp(argc, argv); QApplication a(argc, argv); QWidget window; setMainWindow(&window); diff --git a/selfdrive/ui/qt/util.cc b/selfdrive/ui/qt/util.cc index 16d5c174b..967b7d15d 100644 --- a/selfdrive/ui/qt/util.cc +++ b/selfdrive/ui/qt/util.cc @@ -89,9 +89,18 @@ void setQtSurfaceFormat() { QSurfaceFormat::setDefaultFormat(fmt); } -void initApp() { +void initApp(int argc, char *argv[]) { Hardware::set_display_power(true); Hardware::set_brightness(65); + +#ifdef __APPLE__ + { + // Get the devicePixelRatio, and scale accordingly to maintain 1:1 rendering + QApplication tmp(argc, argv); + qputenv("QT_SCALE_FACTOR", QString::number(1.0 / tmp.devicePixelRatio() ).toLocal8Bit()); + } +#endif + setQtSurfaceFormat(); if (Hardware::EON()) { QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); diff --git a/selfdrive/ui/qt/util.h b/selfdrive/ui/qt/util.h index 1b9461fab..813777710 100644 --- a/selfdrive/ui/qt/util.h +++ b/selfdrive/ui/qt/util.h @@ -19,6 +19,6 @@ void clearLayout(QLayout* layout); void setQtSurfaceFormat(); QString timeAgo(const QDateTime &date); void swagLogMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg); -void initApp(); +void initApp(int argc, char *argv[]); QWidget* topWidget (QWidget* widget); QPixmap loadPixmap(const QString &fileName, const QSize &size = {}, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio); diff --git a/selfdrive/ui/watch3.cc b/selfdrive/ui/watch3.cc index aeabfe110..1752ce9b6 100644 --- a/selfdrive/ui/watch3.cc +++ b/selfdrive/ui/watch3.cc @@ -6,7 +6,7 @@ #include "selfdrive/ui/qt/widgets/cameraview.h" int main(int argc, char *argv[]) { - setQtSurfaceFormat(); + initApp(argc, argv); QApplication a(argc, argv); QWidget w;