Fixed crash on iOS devices due to unsupported selector.

Added check for traiCollection selector.

Task-number: QTBUG-50159
Change-Id: Ie3efafe9e22e59aef862a681ad733f2bb0a5ba49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Harald Meyer 2015-12-24 12:23:14 +01:00 committed by Tor Arne Vestbø
parent a62132b22c
commit 81ee6e763e

View File

@ -105,8 +105,10 @@ QIOSIntegration::QIOSIntegration()
m_touchDevice = new QTouchDevice;
m_touchDevice->setType(QTouchDevice::TouchScreen);
QTouchDevice::Capabilities touchCapabilities = QTouchDevice::Position | QTouchDevice::NormalizedPosition;
if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)
touchCapabilities |= QTouchDevice::Pressure;
if ([mainScreen respondsToSelector:@selector(traitCollection)]) {
if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)
touchCapabilities |= QTouchDevice::Pressure;
}
m_touchDevice->setCapabilities(touchCapabilities);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
QMacInternalPasteboardMime::initializeMimeTypes();