[Interest] New window in Qt makes the application activate

Konrad Rosenbaum konrad at silmor.de
Fri Jan 31 09:00:18 CET 2014


On Friday, Friday 31 January 2014 at 01:54, John Weeks wrote:
> If you have some iterative process going in your Qt application, the
> application is not the active application, and that iterative process
> involves making windows, every time a new window appears, the application
> is yanked to the front and made active.
> 
> I find that very annoying, and so do our customers.

Why open windows at all if you do not intend to actually show the customer 
anything until you are done?

I simply open a status window at the start that shows how far the process has 
gone, not pop up any windows at all during processing, and inform the user of 
success or failure when the process is done - after that the user can decide 
to view all the data at their leisure.

Another technique that I've used is to create tabs in an already open window 
instead of creating more windows. Adding tabs does not change the window 
state.

> Is there a window flag or widget attribute or something that I can set to
> tell Qt not to do that?

There are several possibilities:

The most elegant from a usability viewpoint would probably be one of the 
above: refactor the code.

Instead of calling show() on each Window you could call showMinimized().

You could experiment with setWindowState(windowState() & ~Qt::WindowActive).

You can find out about the state of your application by asking each window 
about its windowState() or simply ask QApplication::activeWindow()!=0.



	Konrad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140131/48b5f5c3/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/20140131/48b5f5c3/attachment.sig>


More information about the Interest mailing list