diff options
author | Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> | 2013-10-28 17:11:10 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 22:51:10 +0100 |
commit | aceb854bbb6582cbdecb4da94b64782c76a653cb (patch) | |
tree | 92844caa016bbd21995667d94b4968796d879dce /src/plugins/platforms/cocoa/qcocoamenu.mm | |
parent | 89ab2671051671ecf440ba480caf0b6b6768b1a9 (diff) |
Different native Cocoa menu fixes.
- Fix location of NSMenu when no NSView is given.
- Fix shortcut when given in text with tab.
Change-Id: Iec21cf3d12084db1e70c1a8779d5482c78285796
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenu.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenu.mm | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 16b02a93f5..329c7a264a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -466,17 +466,21 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf nsPos.y = screen->availableVirtualSize().height() - nsPos.y; } - // Finally, we need to synthesize an event. - NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown - location:nsPos - modifierFlags:0 - timestamp:0 - windowNumber:view ? view.window.windowNumber : 0 - context:nil - eventNumber:0 - clickCount:1 - pressure:1.0]; - [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; + if (view) { + // Finally, we need to synthesize an event. + NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown + location:nsPos + modifierFlags:0 + timestamp:0 + windowNumber:view ? view.window.windowNumber : 0 + context:nil + eventNumber:0 + clickCount:1 + pressure:1.0]; + [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view]; + } else { + [m_nativeMenu popUpMenuPositioningItem:nsItem atLocation:nsPos inView:0]; + } } // The calls above block, and also swallow any mouse release event, |