[Interest] New window in Qt makes the application activate

Konrad Rosenbaum konrad at silmor.de
Mon Feb 3 10:57:02 CET 2014

On Friday, Friday 31 January 2014 at 17:49, John Weeks wrote:
> Have you worked with scientists? :) Our customers may run a process that
> creates literally hundreds of graphs, each in a window, by running an
> automated process.

Yes, it was the best time of my life (except for some parts of childhood)!

At least if you have a brilliant idea in front of a scientist you have a 
decent chance of them noticing... ;-)

> Our customers can write code in our internal language to do very lengthy
> computations analyzing their data. Part of that might include creating a
> graph (in a window!) showing the result of some part of the analysis, or
> of one of many data sets. Being able to see that graph come up allows them
> to monitor the progress of the analysis; having it come up while the
> application is not the active application allows them to compose e-mail,
> browse the web, etc., during an analysis that might take many minutes or
> even hours or days.
> So, no, it wouldn't work to make the windows minimized.

Ok, so the windows are created by user code - that explains why refactoring is 
not exactly desired...

I just tried to recreate your problem (using Qt 5.1.1):

* on Windows 7 it does not matter whether the new window is a child of some 
other window or has some flags set - if the app is not active, the window goes 
to the background

* likewise on Linux with KDE 4.8 it originally did not matter either, but the 
window always came to the foreground - it seemed my KWin is configured in a 
way that enforces this, I found that I could tweak this behavior by changing 
my system settings (Workspace - Window Behavior ->> Focus Stealing Prevention, 
if "Low" the window always pops up, if "High" the window does not activate 
unless it has the mouse under it)

I also experimented with setAttribute(Qt::WA_ShowWithoutActivating) - but my 
system priorities seemed to score higher than this hint

> At the end of the process they want a collection of graphs that will most
> likely then wind up as the basis for a report or a published paper.
> And, again, Windows and Mac OS X aren't doing this- why does Qt do it?

Sorry, I'm not deep enough inside  the Qt sources...

Just: Qt has an incredible amount of customizability. Some default of Qt must 
be slightly different from whatever toolkit you used before.

I suggest you experiment around with a few attributes, hints, etc. Check out 
the documentation of QWidget - you can fine tune this thing to hell and 

My long term suggestion however would still have to be this: give some serious 
thought to long term usability. Related results are often expected in the same 
window (even on Linux these days!). What I do in an app that can run for hours 
before coming up with all the results is: I put it all into tabs and I also 
make sure the results are stored on disk (in some kind of embedded DB), so 
they can be retrieved quickly next time without wasting several CPU hours 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140203/60d0b240/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140203/60d0b240/attachment.sig>

More information about the Interest mailing list