Cocoa Helpers: Add qt_mac_flipRect(const QRect &)

Task-number: QTBUG-33082

Change-Id: If72b2744d3694b3899c124c7a6a6ccc6e6397165
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Gabriel de Dietrich 2014-01-13 14:45:54 +01:00 committed by The Qt Project
parent 278152fffd
commit 11442778ed
2 changed files with 7 additions and 0 deletions

View File

@ -116,6 +116,7 @@ inline NSPoint qt_mac_flipPoint(const QPoint &p)
inline NSPoint qt_mac_flipPoint(const QPointF &p)
{ return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); }
NSRect qt_mac_flipRect(const QRect &rect);
NSRect qt_mac_flipRect(const QRect &rect, QWindow *window);
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);

View File

@ -585,6 +585,12 @@ QString qt_mac_applicationName()
return appName;
}
NSRect qt_mac_flipRect(const QRect &rect)
{
int flippedY = qt_mac_flipYCoordinate(rect.y() + rect.height());
return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
}
/*
Mac window coordinates are in the first quadrant: 0, 0 is at the lower-left
corner of the primary screen. This function converts the given rect to an