summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-09-16 11:07:24 +0200
committerTony Sarajärvi <tony.sarajarvi@digia.com>2014-09-16 22:42:43 +0200
commit055622ed48888d5a38ee8f2314c252c96dc34e84 (patch)
tree90e68f6023e4e0336e579dc1b6b06bfeef5cec24
parentb2b9fdfda0f7838059d7e826d81740977ef35a6e (diff)
OS X: Fix positioning of popup menus in case of native NSWindows
The code transformed the coordinates from the view to the window's content view, and since that content view is flipped in the pure Qt world (content view == QNSView), it manually flipped the coordinates to transform from that to window coordinates. Instead just directly transform the view coordinates to window coordinates using standard Cocoa methods, which then works with any kind of content view and NSWindow configuration. Task-number: QTBUG-40958 Change-Id: Idddd327fe9cff3309606379d0e04ee8b4bd5eece Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index a89979a8ea..3d0201e1a0 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -463,9 +463,8 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
// Else, we need to transform 'pos' to window or screen coordinates.
NSPoint nsPos = NSMakePoint(pos.x() - 1, pos.y());
if (view) {
- // Flip y-coordinate first, the convert to content view space.
- nsPos.y = view.frame.size.height - nsPos.y;
- nsPos = [view convertPoint:nsPos toView:view.window.contentView];
+ // convert coordinates from view to the view's window
+ nsPos = [view convertPoint:nsPos toView:nil];
} else if (!QGuiApplication::screens().isEmpty()) {
QScreen *screen = QGuiApplication::screens().at(0);
nsPos.y = screen->availableVirtualSize().height() - nsPos.y;