QCocoaWindow: fix geometry issue when only minimumSize is set
When only minimumSize was set and it matched to the size NSView was created with, viewDidChangeFrame() was not called for the window and it's internal geometry value was still (0, 0) what led to unpleasant side effects such as QML content was not displayed until something caused an update. Task-number: QTBUG-58963 Change-Id: Ib12d36d405969971e7ff62b79b50c3d78928a649 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
949bce97d0
commit
38a55c7813
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
|
||||
QSet<quint32> m_acceptedKeyDowns;
|
||||
}
|
||||
|
||||
+ (QSizeF)defaultViewSize;
|
||||
- (id)init;
|
||||
- (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow;
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user