diff options
author | Liang Qi <liang.qi@qt.io> | 2017-04-04 18:08:01 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-04 18:09:33 +0200 |
commit | 9419dfe8ee45d08f09c09d3cbece511d721546f0 (patch) | |
tree | 1c4584099fc1efb8de30cc4526ce7ebafe8a8ce9 /src/plugins/platforms/cocoa | |
parent | 8b5aa7b6c40d70a7ec15b3ea485f28a142fb247c (diff) | |
parent | 8675e1c5ee7d1209784a2320f1ae3f486b1eaae4 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
src/plugins/platforms/xcb/qxcbwindow.cpp
Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 29 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 8 |
3 files changed, 14 insertions, 24 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 6478365d07..602cea97a7 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -58,6 +58,8 @@ #include <QDebug> +#include <vector> + enum { defaultWindowWidth = 160, defaultWindowHeight = 160 @@ -1613,6 +1615,13 @@ void QCocoaWindow::recreateWindowIfNeeded() [m_nsWindow closeAndRelease]; if (isChildNSWindow()) [m_view.window.parentWindow removeChildWindow:m_view.window]; + if (isContentView()) { + // We explicitly disassociate m_view from the window's contentView, + // as AppKit does not automatically do this in response to removing + // the view from the NSThemeFrame subview list, so we might end up + // with a NSWindow contentView pointing to a deallocated NSView. + m_view.window.contentView = nil; + } m_nsWindow = 0; } @@ -1636,13 +1645,6 @@ 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(); } } @@ -1862,8 +1864,7 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState) // the new state. return; } - default: - Q_FALLTHROUGH(); + default:; } // Then we apply the new state if needed @@ -1881,12 +1882,8 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState) [m_nsWindow miniaturize:sender]; break; case Qt::WindowNoState: - switch (windowState()) { - case Qt::WindowMaximized: + if (windowState() == Qt::WindowMaximized) toggleMaximized(); - default: - Q_FALLTHROUGH(); - } break; default: Q_UNREACHABLE(); @@ -2068,10 +2065,10 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window) } // Find consecutive registered border areas, starting from the top. - QList<BorderRange> ranges = m_contentBorderAreas.values(); + std::vector<BorderRange> ranges(m_contentBorderAreas.cbegin(), m_contentBorderAreas.cend()); std::sort(ranges.begin(), ranges.end()); int effectiveTopContentBorderThickness = m_topContentBorderThickness; - foreach (BorderRange range, ranges) { + for (BorderRange range : ranges) { // Skip disiabled ranges (typically hidden tool bars) if (!m_enabledContentBorderAreas.value(range.identifier, false)) continue; diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index a05bd66890..75a508370f 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -88,7 +88,6 @@ 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 diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index e16915273a..bbdf9ad44f 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -140,8 +140,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (id) init { - self = [super initWithFrame : NSMakeRect(0, 0, [[self class] defaultViewSize].width(), [[self class] defaultViewSize].height())]; - if (self) { + if (self = [super initWithFrame:NSZeroRect]) { m_backingStore = 0; m_maskImage = 0; m_shouldInvalidateWindowShadow = false; @@ -189,11 +188,6 @@ static bool _q_dontOverrideCtrlLMB = false; [super dealloc]; } -+ (QSizeF)defaultViewSize -{ - return QSizeF(300.0, 300.0); -} - - (id)initWithCocoaWindow:(QCocoaWindow *)platformWindow { self = [self init]; |