QDialogs are always on top - why?
Hi,
I have an application employing a QMainWindow object. There is also an object inherited from QDialog. On pressing certain key this dialog pops up in non-modal mode. But anyway it stays always on top, covering the main window, so I have always to move it aside. I tried to set in the constructor it's windowFlags (~Qt::WindowStaysOnTopHint) but it didn't help. How to make it going behind if focus is passed to the main window?
Re: QDialogs are always on top - why?
If your main window is not the parent of your dialog, you should be able to put the dialog behind the window.
Re: QDialogs are always on top - why?
Ok, that's it, thanks.
But I wonder how should I make it if some dialogs have the main window as the parent? (e.g. to pass QKeyEvents up to the parent with event->ignore() )
Re: QDialogs are always on top - why?
That's strange, have you tried messing with the various window hints? Try
Code:
setWindowFlags(Qt::CustomizeWindowHint | Qt::Dialog);
Re: QDialogs are always on top - why?
Quote:
But I wonder how should I make it if some dialogs have the main window as the parent? (e.g. to pass QKeyEvents up to the parent with event->ignore() )
I haven't had such a case before, but spontaneously I think of: Storing a pointer to your main window in the dialog and then calling QCoreApplication::sendEvent() or QCoreApplication::notify().