首页 > 代码库 > Qt将窗体变为顶层窗体

Qt将窗体变为顶层窗体

//重载resizeEvent和moveEvent两个函数,以保证窗体大小和位置改变后能时刻记住其位置QRect curGemRect = mpWindow->geometry();//激活mpWindow窗体为桌面的顶层窗体Qt::WindowStates winStatus = Qt::WindowNoState;if (mpWindow->windowState() & Qt::WindowMaximized){    winStatus = Qt::WindowMaximized;}mpWindow->setWindowState(Qt::WindowMinimized);mpWindow->setWindowState(Qt::WindowActive | winStatus);mpWindow->setGeometry(curGemRect);mpWindow->activateWindow();mpWindow->raise();

 

Qt将窗体变为顶层窗体