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:
parent
4432ab6398
commit
8e9a065f16
5
qtox.pro
5
qtox.pro
|
@ -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 {
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user