x: (Screen.width - __hintdlgWidth) / 2
y: (Screen.height - __hintdlgHeight) / 2
width: __hintdlgWidth+20
height: __hintdlgHeight+20
color: "#00000000"
flags: Qt.FramelessWindowHint | Qt.Window | Qt.WindowStaysOnTopHint
windows:
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
::SetWindowPos(( HWND )winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
Linux:
setWindowFlags(windowFlags() | Qt::BypassWindowManagerHint);
setWindowFlags(windowFlags() | Qt::X11BypassWindowManagerHint);
activateWindow();
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
raise (); //必须加,不然X11会不起作用
#ifdef Q_OS_WIN32 //windows必须加这个,不然windows10 会不起作用,具体参看activateWindow 函数的文档
HWND hForgroundWnd = GetForegroundWindow();
DWORD dwForeID = ::GetWindowThreadProcessId(hForgroundWnd, NULL);
DWORD dwCurID = ::GetCurrentThreadId();
::AttachThreadInput(dwCurID, dwForeID, TRUE);
::SetForegroundWindow(( HWND )winId());
::AttachThreadInput(dwCurID, dwForeID, FALSE);
#endif // MAC_OS