/ 屏幕中间显示
QDesktopWidget *pDeskWdg = QApplication::desktop();
QRect rctAvaild = pDeskWdg->availableGeometry();
this->move((rctAvaild.width() - this->width()) / 2, (rctAvaild.height() - this->height()) / 2);
this->show();
//
//把窗口带到最顶层
HWND hForegdWnd = ::GetForegroundWindow();
DWORD dwCurID = ::GetCurrentThreadId();
DWORD dwForeID = ::GetWindowThreadProcessId(hForegdWnd, NULL);
::AttachThreadInput(dwCurID, dwForeID, TRUE);
::SetForegroundWindow((HWND)this->winId());
::AttachThreadInput(dwCurID, dwForeID, FALSE);
//
Qt实现界面居中显示,以及顶层显示
最新推荐文章于 2025-02-05 16:04:51 发布