if your main window is in the background and you want to activate it with a qsingleapp, you will have problems bringing the window to the front.
An application can't pull the focus on windows. and activate and rais will bring it to front in some cases but not in all :-( That's why we have this HACK:
@ // THIS IS A HACK:
// from QT documentation:
// void QWidget::activateWindow ()
// On Windows, if you are calling this when the application is not currently
// the active one then it will not make it the active window. It will change
// the color of the taskbar entry to indicate that the window has changed in
// some way. This is because Microsoft do not allow an application to
// interrupt what the user is currently doing in another application.
// This hack does not give the focus to the app but brings it to front so
// the user sees it.
::SetWindowPos(effectiveWinId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
::SetWindowPos(effectiveWinId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
// HACK END
// pWidget->setFocus(); this does not work :-(
It always brings the window to the front, but the focus is somewhere in the system :-( In some other app...
Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)