summaryrefslogtreecommitdiff
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r--src/gui/kernel/qwidget_mac.mm36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 997419b5e9..fc94616c7b 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -226,6 +226,8 @@ static NSDrawer *qt_mac_drawer_for(const QWidget *widget)
for (NSWindow *window in windows) {
NSArray *drawers = [window drawers];
for (NSDrawer *drawer in drawers) {
+ if ([drawer contentView] == widgetView)
+ return drawer;
NSArray *views = [[drawer contentView] subviews];
for (NSView *view in views) {
if (view == widgetView)
@@ -240,6 +242,9 @@ static NSDrawer *qt_mac_drawer_for(const QWidget *widget)
static void qt_mac_destructView(OSViewRef view)
{
#ifdef QT_MAC_USE_COCOA
+ NSWindow *window = [view window];
+ if ([window contentView] == view)
+ [window setContentView:[[NSView alloc] initWithFrame:[view bounds]]];
[view removeFromSuperview];
[view release];
#else
@@ -2294,28 +2299,23 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin
Q_UNUSED(dialog);
data.fstrut_dirty = true; // when we create a toplevel widget, the frame strut should be dirty
+
OSViewRef nsview = (OSViewRef)data.winid;
- OSViewRef window_contentview = qt_mac_get_contentview_for(windowRef);
if (!nsview) {
- nsview = qt_mac_create_widget(q, this, window_contentview);
+ nsview = qt_mac_create_widget(q, this, 0);
setWinId(WId(nsview));
- } else {
- [window_contentview addSubview:nsview];
}
- if (nsview) {
- NSRect bounds = [window_contentview bounds];
- [nsview setFrame:bounds];
- [nsview setHidden:NO];
- if (q->testAttribute(Qt::WA_DropSiteRegistered))
- registerDropSite(true);
- transferChildren();
+ [windowRef setContentView:nsview];
+ [nsview setHidden:NO];
+ if (q->testAttribute(Qt::WA_DropSiteRegistered))
+ registerDropSite(true);
+ transferChildren();
- // Tell Cocoa explicit that we wan't the view to receive key events
- // (regardless of focus policy) because this is how it works on other
- // platforms (and in the carbon port):
- if (!qApp->focusWidget())
- [windowRef makeFirstResponder:nsview];
- }
+ // Tell Cocoa explicit that we wan't the view to receive key events
+ // (regardless of focus policy) because this is how it works on other
+ // platforms (and in the carbon port):
+ if (!qApp->focusWidget())
+ [windowRef makeFirstResponder:nsview];
if (topExtra->posFromMove) {
updateFrameStrut();
@@ -3198,7 +3198,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
if (iconButton == nil) {
QCFString string(q->windowTitle());
const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
- [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]];
+ [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:const_cast<NSString *>(tmpString)]];
iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
}
if (icon.isNull()) {