[Qt-interest] how to raise qt::popup window and steal focus from other apps

william.crocker at analog.com william.crocker at analog.com
Fri Apr 2 16:00:51 CEST 2010



Dmitry Teslenko wrote:
> Hello!
> It's Qt 4.6.1 under WindowsXP.
> 
> I have an QWidget created with Qt::Popup flag. I show it from time to time
> in response to QSystemTrayIcon acitvated signal or global keyboard shortcut.
> I raise it above windows using this code:
> 
> 	show();
> 	activateWindow();
> 	raise();
> 
> Code raises window in any case. But raised popup window sometimes have
> focus, sometimes not.
> When popup was raised in response to systray click, it has focus;
> when it was raised in respone to keyboard shortcut it hasn't focus.
>


Upon the event, schedule the show/activate/raise
with a short single shot timer. Then, upon timer expiration,
do the actual work.


> How to steal focus from other apps' windows?
> 



More information about the Qt-interest-old mailing list