cocoa: override new QPlatformMenu::popup() function
Having two versions of popup, one that takes a point and one that takes a target rect, causes problems for client code if they use the 'target rect' version since not all platforms override that function. So this patch will change the remaining platform that override QPlatformmenu into using the new 'target rect' version. Calling the old version that takes a point will still work, since the base version will then convert the point into a zero-sized rect, and forward the call to the 'target rect' version instead. Change-Id: Icc8531d79270a4f24ec08b8ed95b18ed3db1ad4d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
parent
1e1f5833b1
commit
9af7104359
@ -59,7 +59,7 @@ public:
|
||||
void syncMenuItem(QPlatformMenuItem *menuItem);
|
||||
void setEnabled(bool enabled);
|
||||
void setVisible(bool visible);
|
||||
void showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item);
|
||||
void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item);
|
||||
void dismiss();
|
||||
|
||||
void syncSeparatorsCollapsible(bool enable);
|
||||
|
@ -433,10 +433,11 @@ void QCocoaMenu::setVisible(bool visible)
|
||||
m_visible = visible;
|
||||
}
|
||||
|
||||
void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item)
|
||||
void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item)
|
||||
{
|
||||
QCocoaAutoReleasePool pool;
|
||||
|
||||
QPoint pos = QPoint(targetRect.left(), targetRect.top() + targetRect.height());
|
||||
QCocoaWindow *cocoaWindow = parentWindow ? static_cast<QCocoaWindow *>(parentWindow->handle()) : 0;
|
||||
NSView *view = cocoaWindow ? cocoaWindow->contentView() : nil;
|
||||
NSMenuItem *nsItem = item ? ((QCocoaMenuItem *)item)->nsItem() : nil;
|
||||
|
Loading…
Reference in New Issue
Block a user