Skip to content

Commit 089cd30

Browse files
committed
QGuiApplication::primaryScreenChanged was only added in Qt 5.6
1 parent 61d01fb commit 089cd30

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/core/device.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ Device::Device(QObject *parent)
1616
QGuiApplication *app = (QGuiApplication *) QGuiApplication::instance();
1717
m_screen = app->primaryScreen();
1818

19+
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
1920
connect(app, &QGuiApplication::primaryScreenChanged,
2021
this, &Device::screenChanged);
22+
#endif
2123
}
2224

2325
QObject *Device::qmlSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)

src/core/units.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ void UnitsAttached::screenChanged(QScreen *screen)
6464
}
6565

6666
int UnitsAttached::dp() const {
67-
QString qtVersion = qVersion();
68-
69-
if (qtVersion > "5.6") {
67+
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
7068
return 1;
71-
} else {
69+
#else
7270
return dpi()/160;
73-
}
71+
#endif
7472
}
7573

7674
int UnitsAttached::dpi() const

0 commit comments

Comments
 (0)