MacOS: ensure 1:1 rendering on HiDPI screens (#23860)
parent
9c70e8bcad
commit
ca8d4e417e
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue