diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-23 07:13:00 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-23 07:13:00 +0100 |
commit | 1ed7a67a4cef8350103e4ea33b4bbd084f5d4c2d (patch) | |
tree | 03dd7b6f8d9ccc02da6d0d882793ec62c71b00f7 /src/plugins/platforms/ios | |
parent | dbb7817e13bc7f7ccb8f04b00a65eb3dcf8d25f8 (diff) | |
parent | 6a2b17eeec2d171d2afa17bdbc36456346bfd13b (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/kernel/qcoreapplication.cpp
src/corelib/thread/qthread_unix.cpp
Change-Id: Ia08d613c3f0bd08cb6dc3e3a57257207dfd4a099
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r-- | src/plugins/platforms/ios/qiosscreen.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosscreen.mm | 25 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index a0aa922a31..f31be9756c 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -73,7 +73,7 @@ private: QRect m_geometry; QRect m_availableGeometry; int m_depth; - uint m_unscaledDpi; + uint m_pixelDensity; QSizeF m_physicalSize; QIOSOrientationListener *m_orientationListener; }; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 3e16efcd22..5cb06d591d 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -170,23 +170,28 @@ QIOSScreen::QIOSScreen(UIScreen *screen) if (screen == [UIScreen mainScreen]) { QString deviceIdentifier = deviceModelIdentifier(); - if (deviceIdentifier == QLatin1String("iPhone2,1") /* iPhone 3GS */ - || deviceIdentifier == QLatin1String("iPod3,1") /* iPod touch 3G */) { + // Based on https://en.wikipedia.org/wiki/List_of_iOS_devices#Display + + // iPhone (1st gen), 3G, 3GS, and iPod Touch (1st–3rd gen) are 18-bit devices + if (deviceIdentifier.contains(QRegularExpression("^(iPhone1,[12]|iPhone2,1|iPod[1-3],1)$"))) m_depth = 18; - } else { + else m_depth = 24; - } - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad - && !deviceIdentifier.contains(QRegularExpression("^iPad2,[567]$")) /* excluding iPad Mini */) { - m_unscaledDpi = 132; + if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2)$"))) { + // iPhone 6 Plus or iPhone 6S Plus + m_pixelDensity = 401; + } else if (deviceIdentifier.contains(QRegularExpression("^iPad(1,1|2,[1-4]|3,[1-6]|4,[1-3]|5,[3-4]|6,[7-8])$"))) { + // All iPads except the iPad Mini series + m_pixelDensity = 132 * devicePixelRatio(); } else { - m_unscaledDpi = 163; // Regular iPhone DPI + // All non-Plus iPhones, and iPad Minis + m_pixelDensity = 163 * devicePixelRatio(); } } else { // External display, hard to say m_depth = 24; - m_unscaledDpi = 96; + m_pixelDensity = 96; } for (UIWindow *existingWindow in [[UIApplication sharedApplication] windows]) { @@ -249,7 +254,7 @@ void QIOSScreen::updateProperties() if (m_geometry != previousGeometry) { const qreal millimetersPerInch = 25.4; - m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch; + m_physicalSize = QSizeF(m_geometry.size() * devicePixelRatio()) / m_pixelDensity * millimetersPerInch; } // At construction time, we don't yet have an associated QScreen, but we still want |