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>bb10
parent
b2b9fdfda0
commit
055622ed48
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue