PDA

View Full Version : How to have a MainWindow always on top of another MainWindow on Mac



kalos80
6th July 2010, 12:08
Hi,

I'm getting crazy with a simple problem and would be really grateful if someone could help me solving it.

I have a MainWindow say W1 which is the main application. When the user clicks a button, I open a new MainWindow, say W2, having W1 as parent. The new MainWindow W2 is shown on top of its parent Window W1, which is fair.

On Windows if I click on W1, W2 loses focus but it KEEPS staying on top of W1.
On Mac there is a different behavior, if I click on W1, then W2 goes behind W1, while I would like to have W2 always on top of W1.

I tried to use the Qt::WindowStaysOnTopHint flag when creating W2 window. It works, but it is "too much", because if a modal dialog is opened from W1 when W2 is shown (say an error message from W1) then it appears behind W2 and I can not click on it.

I'm using the latest version of Qt 4.6.3.

Thanks in advance for your help

kalos80
6th July 2010, 13:03
I just solved the problem creating the MainWindow with the Qt::Dialog flag.