Cocoa: Fix NSMenu popup coordinates

Those should be in window coordinates (or rather, its content view)
not view coordinates.

Task-number: QTBUG-32826
Change-Id: I52dddeccf17b359163ad477ce4299b934633b4fa
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Gabriel de Dietrich 2013-09-03 14:23:33 +02:00 committed by The Qt Project
parent 8fd71914b4
commit 9554088557

View File

@ -455,7 +455,9 @@ 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];
} else if (!QGuiApplication::screens().isEmpty()) {
QScreen *screen = QGuiApplication::screens().at(0);
nsPos.y = screen->availableVirtualSize().height() - nsPos.y;