1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(hidpi): enable HiDPI support if Qt supports it

Previously HiDPI support is conditionally enabled based on compilation
parameters as well as environmental variables which makes binary
distribution difficult. This commit automatically enables runtime DPI
scaling if Qt supports it (version 5.6 and beyond).
This commit is contained in:
initramfs 2016-05-04 18:31:24 +08:00
parent 4432ab6398
commit 8e9a065f16
No known key found for this signature in database
GPG Key ID: 78B8BDF87E9EF0AF
2 changed files with 6 additions and 9 deletions

View File

@ -108,11 +108,6 @@ contains(DISABLE_FILTER_AUDIO, NO) {
DEFINES += QTOX_FILTER_AUDIO
}
contains(HIGH_DPI, YES) {
QT_DEVICE_PIXEL_RATIO= auto
DEFINES += HIGH_DPI
}
contains(JENKINS,YES) {
INCLUDEPATH += ./libs/include/
} else {

View File

@ -117,6 +117,12 @@ void logMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QSt
int main(int argc, char *argv[])
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
qInstallMessageHandler(logMessageHandler);
QApplication a(argc, argv);
@ -129,10 +135,6 @@ int main(int argc, char *argv[])
osx::migrateProfiles();
#endif
#ifdef HIGH_DPI
a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
qsrand(time(0));
Settings::getInstance();
Translator::translate();