diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 75c13d6bbc..cfe829905c 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1636,6 +1636,13 @@ void QCocoaWindow::recreateWindowIfNeeded() [m_nsWindow setContentView:m_view]; [m_view release]; [m_view setPostsFrameChangedNotifications:YES]; + // QTBUG-58963 + // viewDidChangeFrame() should be called for each window automatically at this point because it is + // registered with Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification); + // The corner case when it's not called and we need to make a manual geometry update is when window's + // size is not specified explicitly but minimumSize is set and matches to the size NSView was created with. + if (QSizeF::fromCGSize(m_view.frame.size) == [QNSView defaultViewSize]) + viewDidChangeFrame(); } } diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 75a508370f..a05bd66890 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -88,6 +88,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); QSet m_acceptedKeyDowns; } ++ (QSizeF)defaultViewSize; - (id)init; - (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow; #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 40efa092b3..967271be9c 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -140,7 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (id) init { - self = [super initWithFrame : NSMakeRect(0,0, 300,300)]; + self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())]; if (self) { m_backingStore = 0; m_maskImage = 0; @@ -189,6 +189,11 @@ static bool _q_dontOverrideCtrlLMB = false; [super dealloc]; } ++ (QSizeF)defaultViewSize +{ + return QSizeF(300.0, 300.0); +} + - (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow { self = [self init];