Main application window and a dialog interaction
-
Good day!
Have a problem: main window (MyApp for example) works in background (behind all other windows or in tray), not necessary to show it without need. After some period of time some reminding StayOnTop dialog appears (having parent = 0, to be not tied to main window) and asks for some user interactions. After dialog closes I'd like to keep an application window user currently working with active, and user continue do his job not switching to MyApp. However, instead of above behaviour, main MyApp window appears and user forces to switch back to his window (job) - inconvenient.
How to prevent MyApp main window appearing after closing the dialog? Need to install some event filter or access OS API? Problem exists in Mac, Windows, Linux.
-
What do you mean with "main window works in background"? Is it hidden? If i understood it right, if you close the StayOnTop-Window, your mainwindow appears, right? And that is what you don't want? What about hiding it again or just work without a mainwindow like a service/daemon in background?
Sorry, i did not really understand...
-
I mean that it could be behind other windows (inactive) or minimized, for example. Yes, You understand right: if I close the StayOnTop-Window, mine mainwindow appears, I don't want that.
I just do not understand why after dialog finished Qt raises main Window??? Hiding may be not correct in some cases if user works with MyApp, for example. After dialog finishing user have to have same application windows active as he had before dialog rising.
-
[quote author="AlekseyK" date="1312545181"]I mean that it could be behind other windows (inactive) or minimized, for example. Yes, You understand right: if I close the StayOnTop-Window, mine mainwindow appears, I don't want that.
I just do not understand why after dialog finished Qt raises main Window??? Hiding may be not correct in some cases if user works with MyApp, for example. After dialog finishing user have to have same application windows active as he had before dialog rising.[/quote]
That's done by the OS. If you close a top level window inside your process that has the input focus, the input focus is moved to another window inside your process if there are some visible ones. That includes raising them.
-
Any way to change this? OS API only?
-
AFAIK not, or not on Windows. Windows does some things, you can't change. perhaps you can set your main window disabled to cheat, but I'm not sure if that works...
-
Hmm... why Window Flags Qt example does not have that problem in that case? However not in Mac, need to check other OSs.