Enable HiDPI Scaling (Qt 5.6+ only) [stable-1.2] (#3814)

Enables HiDPI Scaling in GuiApplication.cpp, environmental variable and mac manifest
This commit is contained in:
flynn16
2017-09-21 01:12:41 +08:00
committed by Tres Finocchiaro
parent 4e3c6b0940
commit 8a39302571
3 changed files with 9 additions and 1 deletions

View File

@@ -143,6 +143,8 @@
</dict>
</dict>
</array>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>

View File

@@ -8,7 +8,7 @@ Comment=easy music production for everyone!
Comment[ca]=Producció fàcil de música per a tothom!
Comment[fr]=Production facile de musique pour tout le monde !
Icon=lmms
Exec=env QT_X11_NO_NATIVE_MENUBAR=1 lmms %f
Exec=env QT_X11_NO_NATIVE_MENUBAR=1 QT_AUTO_SCREEN_SCALE_FACTOR=1 lmms %f
Terminal=false
Type=Application
Categories=Qt;AudioVideo;Audio;Midi;

View File

@@ -40,6 +40,7 @@
#include "SongEditor.h"
#include <QApplication>
#include <QtGlobal>
#include <QMessageBox>
#include <QSplashScreen>
@@ -53,6 +54,11 @@ GuiApplication* GuiApplication::instance()
GuiApplication::GuiApplication()
{
// enable HiDPI scaling before showing anything (Qt 5.6+ only)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#endif
// prompt the user to create the LMMS working directory (e.g. ~/lmms) if it doesn't exist
if ( !ConfigManager::inst()->hasWorkingDir() &&
QMessageBox::question( NULL,