Cocoa: Add support for ForeignWindow window type
Necessary to make QWindow::fromWinId() work on Mac. Change-Id: I0dc3a1b0d63cff61d484693aee711dc54fea6b2f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
bdebec4e2e
commit
7e7d40eeb7
@ -352,6 +352,7 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
|
||||
case BufferQueueingOpenGL:
|
||||
case WindowMasks:
|
||||
case MultipleWindows:
|
||||
case ForeignWindows:
|
||||
return true;
|
||||
default:
|
||||
return QPlatformIntegration::hasCapability(cap);
|
||||
|
@ -192,6 +192,8 @@ const int QCocoaWindow::NoAlertRequest = -1;
|
||||
|
||||
QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
||||
: QPlatformWindow(tlw)
|
||||
, m_contentView(nil)
|
||||
, m_qtView(nil)
|
||||
, m_nsWindow(0)
|
||||
, m_contentViewIsEmbedded(false)
|
||||
, m_contentViewIsToBeEmbedded(false)
|
||||
@ -212,8 +214,13 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
||||
#endif
|
||||
QCocoaAutoReleasePool pool;
|
||||
|
||||
m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
|
||||
m_contentView = m_qtView;
|
||||
if (tlw->type() == Qt::ForeignWindow) {
|
||||
NSView *foreignView = (NSView *)WId(tlw->property("_q_foreignWinId").value<WId>());
|
||||
setContentView(foreignView);
|
||||
} else {
|
||||
m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
|
||||
m_contentView = m_qtView;
|
||||
}
|
||||
setGeometry(tlw->geometry());
|
||||
recreateWindow(parent());
|
||||
tlw->setGeometry(geometry());
|
||||
|
Loading…
Reference in New Issue
Block a user