diff options
Diffstat (limited to 'src/plugins/platforms/ios/quiview.mm')
-rw-r--r-- | src/plugins/platforms/ios/quiview.mm | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index a4cdedaff7..9289cc68c9 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -45,6 +45,7 @@ #include "qiostextresponder.h" #include "qiosscreen.h" #include "qioswindow.h" +#include "qiosinputcontext.h" #ifndef Q_OS_TVOS #include "qiosmenu.h" #endif @@ -263,7 +264,8 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") - (BOOL)canBecomeFirstResponder { - return !(self.platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus); + return !(self.platformWindow->window()->flags() & (Qt::WindowDoesNotAcceptFocus + | Qt::WindowTransparentForInput)); } - (BOOL)becomeFirstResponder @@ -463,7 +465,10 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::AsynchronousDelivery>( self.platformWindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values()); } else { - QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>( + // Send the touch event asynchronously, as the application might spin a recursive + // event loop in response to the touch event (a dialog e.g.), which will deadlock + // the UIKit event delivery system (QTBUG-98651). + QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::AsynchronousDelivery>( self.platformWindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values()); } } @@ -569,7 +574,12 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") NSTimeInterval timestamp = event ? event.timestamp : [[NSProcessInfo processInfo] systemUptime]; QIOSIntegration *iosIntegration = static_cast<QIOSIntegration *>(QGuiApplicationPrivate::platformIntegration()); - QWindowSystemInterface::handleTouchCancelEvent(self.platformWindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice()); + + // Send the touch event asynchronously, as the application might spin a recursive + // event loop in response to the touch event (a dialog e.g.), which will deadlock + // the UIKit event delivery system (QTBUG-98651). + QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::AsynchronousDelivery>( + self.platformWindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice()); } - (int)mapPressTypeToKey:(UIPress*)press @@ -652,6 +662,18 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") [super addInteraction:interaction]; } +- (UIEditingInteractionConfiguration)editingInteractionConfiguration +{ + // We only want the three-finger-tap edit menu to be available when there's + // actually something to edit. Otherwise the OS will cause a slight delay + // before delivering the release of three finger touch input. Note that we + // do not do any hit testing here to check that the focus object is the one + // being tapped, as the behavior of native iOS apps is to trigger the menu + // regardless of where the gesture is being made. + return QIOSInputContext::instance()->inputMethodAccepted() ? + UIEditingInteractionConfigurationDefault : UIEditingInteractionConfigurationNone; +} + @end @implementation UIView (QtHelpers) |