summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2015-12-16 23:38:13 +0100
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2015-12-17 13:47:21 +0000
commitbace82bffe7289d1a10ad652c4510b193d71c922 (patch)
treea5ce43bf7ccc64f209bfc4b5fd921a56e138231b /src/plugins
parente362774df22846e100237739c0cb7190100d265b (diff)
iOS: notify application when edit menu is closed
The edit menu will also close if the user taps outside it, not only when selecting a menu item. But we never caught this case, which left QMenu to belive that it was still open. Change-Id: Iae071b4fc5fdc44d7d05b4dd767042907e337957 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 7aea3729fd..612f8c43a2 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -61,11 +61,23 @@ static NSString *const kSelectorPrefix = @"_qtMenuItem_";
{
if (self = [super init]) {
[self setVisibleMenuItems:visibleMenuItems];
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(menuClosed)
+ name:UIMenuControllerDidHideMenuNotification object:nil];
}
return self;
}
+-(void)dealloc
+{
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:UIMenuControllerDidHideMenuNotification object:nil];
+ [super dealloc];
+}
+
- (void)setVisibleMenuItems:(const QIOSMenuItemList &)visibleMenuItems
{
m_visibleMenuItems = visibleMenuItems;
@@ -85,6 +97,11 @@ static NSString *const kSelectorPrefix = @"_qtMenuItem_";
[[UIMenuController sharedMenuController] setMenuVisible:YES animated:NO];
}
+-(void)menuClosed
+{
+ QIOSMenu::currentMenu()->dismiss();
+}
+
- (id)targetForAction:(SEL)action withSender:(id)sender
{
Q_UNUSED(sender);