[Qt-interest] Popup window without stealing focus

Martin Guillon MGuillon at movea.com
Tue Feb 23 15:48:23 CET 2010


I actually sent a mail about that exact same problem. I managed to make it work under windows but not under osx.
One thing you can do though to make it a little better is modify the info.plist of your app so that you app doesn't have menu or a dock icon (agent app). That way when the popup appears you keep the menu of the background app.
By the way, I use subWindow and no Tools, but I don't think it would make a difference.

Martin

From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Jason Wood
Sent: Tuesday, February 23, 2010 1:23 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Popup window without stealing focus

Hi,

I have a QMainWindow which is a small popup (like a Growl notification window), which I set the following in the constructor:


this->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Tool);

this->setFocusPolicy(Qt::NoFocus);

this->setAttribute(Qt::WA_ShowWithoutActivating);



But it always steals focus when I call .show() on the window. Is there a way to have it popup without stealing the focus? My application lives in the background (UIElement set to true in Info.plist) and has no main window by default, perhaps the problem is the application coming to front rather than the window? The window does not seem to be focussed but the currently selected window in Finder or other application loses focus when it displays.



Does anyone have any tips to get round this?



Thanks,



Jason.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100223/7fb7be0e/attachment.html 


More information about the Qt-interest-old mailing list