Skip to content

Commit

Permalink
fix: respect the setting of QT_ENABLE_HIGHDPI_SCALING of the system (#…
Browse files Browse the repository at this point in the history
…2077)

* fix: respect the setting of QT_ENABLE_HIGHDPI_SCALING of the system

Setting QT_ENABLE_HIGHDPI_SCALING to 1 might not work well in some
cases. Instead of hard-coding it to 1, this commit checks if it is
already set, and if it is empty or not set, then set it to 1. This
allows overriding the QT_ENABLE_HIGHDPI_SCALING to 0 by respecting the
system-wide setting of environment variables.

* fix: move setHighDpiScaleFactorRoundingPolicy out of the check of QT_ENABLE_HIGHDPI_SCALING

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
HanatoK and autofix-ci[bot] authored Jan 14, 2025
1 parent 15417a6 commit fd42f81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ int main( int argc, char ** argv )


//high dpi screen support
qputenv( "QT_ENABLE_HIGHDPI_SCALING", "1" );
if ( !qEnvironmentVariableIsSet( "QT_ENABLE_HIGHDPI_SCALING" )
|| qEnvironmentVariableIsEmpty( "QT_ENABLE_HIGHDPI_SCALING" ) ) {
qputenv( "QT_ENABLE_HIGHDPI_SCALING", "1" );
}
QApplication::setHighDpiScaleFactorRoundingPolicy( Qt::HighDpiScaleFactorRoundingPolicy::PassThrough );

QHotkeyApplication app( "GoldenDict-ng", argc, argv );
Expand Down

0 comments on commit fd42f81

Please sign in to comment.