Skip to content

Commit

Permalink
[Qt] Enable automatic application scaling for recent Qt versions on W…
Browse files Browse the repository at this point in the history
…indows to deal with HiDPI displays

This should save users the hassle to set environment variable QT_AUTO_SCREEN_SCALE_FACTOR to achieve the same effect.
  • Loading branch information
eumagga0x2a committed Mar 31, 2019
1 parent 8530e2d commit 49dec8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions avidemux/qt4/ADM_jobs/src/ADM_jobControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ bool jobWindow::popup(const char *errorMessage)
bool jobRun(int ac,char **av)
{
initTranslator();
#if defined(_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5,11,0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QApplication *app=new QApplication(ac,av,0);
Q_INIT_RESOURCE(jobs);
loadTranslator();
Expand Down
6 changes: 5 additions & 1 deletion avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,11 @@ int UI_Init(int nargc, char **nargv)
global_argc=nargc;
global_argv=nargv;
ADM_renderLibInit(&UI_Hooks);

#if defined(_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5,11,0)
// Despite HiDPI scaling being supported from Qt 5.6 on, important aspects
// like OpenGL support were fixed only in much later versions.
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
myApplication=new myQApplication (global_argc, global_argv);
myApplication->connect(myApplication, SIGNAL(lastWindowClosed()), myApplication, SLOT(quit()));
myApplication->connect(myApplication, SIGNAL(aboutToQuit()), myApplication, SLOT(cleanup()));
Expand Down

0 comments on commit 49dec8d

Please sign in to comment.