PDA

View Full Version : How to raise/lower a Qt application behind an other Qt application



xtofl
12th October 2012, 09:46
Hi,

I have two apps, one of which has to start _behind_ the other. I tried doing this using the `showMinimized()` call for the behind one, but this has an undesired side-effect: when switching to it later on, the application is 'animated' to maximum size.

The current code:


if( iAmMaster() )
mainWindow->show();
else
mainWindow->showMinimized();

In both apps, I known the window handle of the other one.

Is there a better way?

Thanks!

xtofl

wysota
12th October 2012, 10:00
Which platform?

xtofl
12th October 2012, 15:48
I was hoping the platform wouldn't matter. But I'm on a WinXP with Qt4.6.3.

wysota
12th October 2012, 17:23
If you are on Windows then you can use WinAPI PostMessage() call to post a message to the other application to raise/lower its window. For that you can either use WinAPI calls or QWidget::raise(), QWidget::lower() if they are both Qt apps.