| 1829 | } |
| 1830 | |
| 1831 | void MainWindow::bringWindowToForeground() |
| 1832 | { |
| 1833 | qInfo(Q_FUNC_INFO); |
| 1834 | |
| 1835 | // There doesn't seem to be a cross platform way to force the window to the foreground |
| 1836 | |
| 1837 | #ifdef Q_OS_WIN |
| 1838 | HWND hWnd = reinterpret_cast<HWND>(effectiveWinId()); |
| 1839 | |
| 1840 | if (hWnd) { |
| 1841 | // I have no idea what this does, but it seems to work on Windows |
| 1842 | // References: |
| 1843 | // https://stackoverflow.com/questions/916259/win32-bring-a-window-to-top |
| 1844 | // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/ebe7648ee1a5a560d4fc65297cbdcf08055e56e3/PowerEditor/src/winmain.cpp#L596 |
| 1845 | |
| 1846 | HWND hCurWnd = GetForegroundWindow(); |
| 1847 | DWORD threadId = GetCurrentThreadId(); |
| 1848 | DWORD procId = GetWindowThreadProcessId(hCurWnd, NULL); |
| 1849 | |
| 1850 | int sw = 0; |
| 1851 | if (IsZoomed(hWnd)) { |
| 1852 | sw = SW_MAXIMIZE; |
| 1853 | } else if (IsIconic(hWnd)) { |
| 1854 | sw = SW_RESTORE; |
| 1855 | } |
| 1856 | |
| 1857 | if (sw != 0) { |
| 1858 | ShowWindow(hWnd, sw); |
| 1859 | } |
| 1860 | |
| 1861 | AttachThreadInput(procId, threadId, TRUE); |
| 1862 | SetForegroundWindow(hWnd); |
| 1863 | SetFocus(hWnd); |
| 1864 | AttachThreadInput(procId, threadId, FALSE); |
| 1865 | } |
| 1866 | #else |
| 1867 | setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); |
| 1868 | raise(); |
| 1869 | activateWindow(); |
| 1870 | #endif |
| 1871 | } |
| 1872 | |
| 1873 | bool MainWindow::checkFileForModification(ScintillaNext *editor) |
| 1874 | { |
nothing calls this directly
no outgoing calls
no test coverage detected