Cocoa: Fix incorrect QSystemTrayIcon::geometry()

The coordinate conversion was wrong. Use
QCocoaScreen::mapFromNative() instead.

Task-number: QTBUG-53184
Change-Id: I50f18d68ba5d7e1cb5046523a608bfa2e076d7ea
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Morten Johan Sørvig 2018-02-22 09:24:32 +01:00
parent 669070c404
commit 8bb33c2509

View File

@ -84,6 +84,8 @@
#include "qt_mac_p.h"
#include "qcocoahelpers.h"
#include "qcocoaintegration.h"
#include "qcocoascreen.h"
#include <QtGui/private/qcoregraphics_p.h>
#import <AppKit/AppKit.h>
@ -385,9 +387,8 @@ QT_END_NAMESPACE
}
-(QRectF)geometry {
if (NSWindow *window = [[item view] window]) {
NSRect screenRect = [[window screen] frame];
NSRect windowRect = [window frame];
return QRectF(windowRect.origin.x, screenRect.size.height-windowRect.origin.y-windowRect.size.height, windowRect.size.width, windowRect.size.height);
if (QCocoaScreen *screen = QCocoaIntegration::instance()->screenForNSScreen([window screen]))
return screen->mapFromNative([window frame]);
}
return QRectF();
}