File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ class CFramelessWindow : public QMainWindow
143143 bool m_bCloseBtnQuit;
144144 bool m_bNativeSystemBtn;
145145 bool m_bIsCloseBtnEnabled, m_bIsMinBtnEnabled, m_bIsZoomBtnEnabled;
146+ bool m_bInitialized;
146147
147148 // ===============================================
148149 // TODO
Original file line number Diff line number Diff line change 1313 m_bIsCloseBtnEnabled(true ),
1414 m_bIsMinBtnEnabled(true ),
1515 m_bIsZoomBtnEnabled(true ),
16- m_bTitleBarVisible(false )
16+ m_bTitleBarVisible(false ),
17+ m_bInitialized(false )
1718{
18- initUI ();
1919}
2020
2121@interface AppObserver : NSObject
@@ -237,6 +237,12 @@ - (void)zoomButtonAction:(id)sender
237237
238238void CFramelessWindow::showEvent (QShowEvent *event)
239239{
240+ // Initialize the window styling on first show, when the native window is fully created
241+ if (!m_bInitialized) {
242+ m_bInitialized = true ;
243+ initUI ();
244+ }
245+
240246 // FIXME: Figure out why this fails to trigger our AppObserver listener sometimes. :/
241247 [NSApp unhide: nil ];
242248 QMainWindow::showEvent (event);
@@ -308,7 +314,7 @@ - (void)zoomButtonAction:(id)sender
308314
309315 m_bTitleBarVisible = bTitlebarVisible;
310316 if (bTitlebarVisible) {
311- window.styleMask ^= NSWindowStyleMaskFullSizeContentView ; // MAC_10_10及以上版本支持
317+ window.styleMask &= ~ NSWindowStyleMaskFullSizeContentView ; // MAC_10_10及以上版本支持
312318 } else {
313319 window.styleMask |= NSWindowStyleMaskFullSizeContentView ; // MAC_10_10及以上版本支持
314320 }
You can’t perform that action at this time.
0 commit comments