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

Dmitry Teslenko dteslenko at gmail.com
Fri Apr 2 14:07:33 CEST 2010


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.

How to steal focus from other apps' windows?

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?



More information about the Qt-interest-old mailing list