Commit 9c945faa authored by Friedemann Kleint's avatar Friedemann Kleint

app: Use HighDPI application attribute instead of environment variable.

Set Qt::AA_EnableHighDpiScaling introduced in Qt 5.6.

Amend change f4e5210c which apparently
was broken by qtbase:add58edcdbd986e68cdd65a2a935b76d85d5b639.

Change-Id: I0a9337f17b02704e36915f78b1321287e4112378
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
parent 2a42ad08
......@@ -159,7 +159,7 @@ static inline int askMsgSendFailed()
QMessageBox::Retry);
}
static const char* setHighDpiEnvirnonmentVariable()
static const char *setHighDpiEnvironmentVariable()
{
const char* envVarName = 0;
static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO";
......@@ -170,14 +170,12 @@ static const char* setHighDpiEnvirnonmentVariable()
qputenv(envVarName, "auto");
}
#else
static const char ENV_VAR_QT_AUTO_SCREEN_SCALE_FACTOR[] = "QT_AUTO_SCREEN_SCALE_FACTOR";
if (Utils::HostOsInfo().isWindowsHost()
&& !qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) // legacy in 5.6, but still functional
&& !qEnvironmentVariableIsSet(ENV_VAR_QT_AUTO_SCREEN_SCALE_FACTOR)
&& !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR")
&& !qEnvironmentVariableIsSet("QT_SCALE_FACTOR")
&& !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) {
envVarName = ENV_VAR_QT_AUTO_SCREEN_SCALE_FACTOR;
qputenv(envVarName, "true");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
}
#endif // < Qt 5.6
return envVarName;
......@@ -304,7 +302,7 @@ static const char *SHARE_PATH =
int main(int argc, char **argv)
{
const char *highDpiEnvironmentVariable = setHighDpiEnvirnonmentVariable();
const char *highDpiEnvironmentVariable = setHighDpiEnvironmentVariable();
QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false"));
#ifdef Q_OS_MAC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment