From 92c18b4866debd2bed945c43b84e90db1397e2c2 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 12 Aug 2020 22:49:58 -0400 Subject: [PATCH 1/2] qt auto scale factor for HiDPI Signed-off-by: Mabel Zhang --- src/gui/Gui.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/Gui.cc b/src/gui/Gui.cc index 3221086268..1c67a24c72 100644 --- a/src/gui/Gui.cc +++ b/src/gui/Gui.cc @@ -53,6 +53,9 @@ std::unique_ptr createGui( ignmsg << "Ignition Gazebo GUI v" << IGNITION_GAZEBO_VERSION_FULL << std::endl; + // Set auto scaling factor for HiDPI displays + qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); + // Initialize Qt app auto app = std::make_unique(_argc, _argv); app->AddPluginPath(IGN_GAZEBO_GUI_PLUGIN_INSTALL_DIR); From 04488ee8b181b97eaa2d4ba15ae82a54c35a3532 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 19 Aug 2020 01:59:48 -0400 Subject: [PATCH 2/2] allow user to specify env var Signed-off-by: Mabel Zhang --- src/gui/Gui.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/Gui.cc b/src/gui/Gui.cc index 1c67a24c72..6ff47d93b1 100644 --- a/src/gui/Gui.cc +++ b/src/gui/Gui.cc @@ -54,7 +54,10 @@ std::unique_ptr createGui( << std::endl; // Set auto scaling factor for HiDPI displays - qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); + if (QString::fromLocal8Bit(qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR")).isEmpty()) + { + qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); + } // Initialize Qt app auto app = std::make_unique(_argc, _argv);