解決Qt中的mdiArea在showMaximized()之後依舊存在最小化最大化和關閉按鈕

  我將viewWidget作爲mdiArea控件的子窗體,並實現viewWidget的最大化,此時在控件右上角會出現最小化、最大化與關閉按鈕,我希望能夠隱藏這三個按鈕,於是調用setWindowFlags函數並嘗試使用了

Qt::Dialog、

Qt::CustomizeWindowHin、

QMdiArea::DontMaximizeSubWindowOnActivation、

Qt::Window、

Qt::WindowMinMaxButtonsHint、

Qt::WindowCloseButtonHint

等參數,均無法滿足要求,原來在執行m_mdiArea->addSubWindow()函數時,將Qt::CustomizeWindowHint同時作爲參數即可實現,即mdiArea->addSubWindow(viewWidget, Qt::CustomizeWindowHint);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章