Bringing window to the front
But with a twist.
I have following code to bring window to the front:
QWidget* tlw = this;
tlw->setWindowState((tlw->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); tlw->activateWindow(); tlw->raise();
It works ok on Linux with local display server (X.org+Unity). Unfortunately it does not work at all on Linux when display server is remote Xming on Windows (7). How can I fix it? (Running app on Window naively is not possible)
Not sure it will help, but have you read this from the doc?
On X11, a window does not have a frame until the window manager decorates it. This happens asynchronously at some point in time after calling QWidget::show() and the first paint event the window receives, or it does not happen at all. Bear in mind that X11 is policy-free (others call it flexible). Thus you cannot make any safe assumption about the decoration frame your window will get. Basic rule: There's always one user who uses a window manager that breaks your assumption, and who will complain to you.
Furthermore, a toolkit cannot simply place windows on the screen. All Qt can do is to send certain hints to the window manager. The window manager, a separate process, may either obey, ignore or misunderstand them. Due to the partially unclear Inter-Client Communication Conventions Manual (ICCCM), window placement is handled quite differently in existing window managers.
X11 provides no standard or easy way to get the frame geometry once the window is decorated. Qt solves this problem with nifty heuristics and clever code that works on a wide range of window managers that exist today. Don't be surprised if you find one where QWidget::frameGeometry() returns wrong results though.
Nor does X11 provide a way to maximize a window. QWidget::showMaximized() has to emulate the feature. Its result depends on the result of QWidget::frameGeometry() and the capability of the window manager to do proper window placement, neither of which can be guaranteed.[/quote]