PDA

View Full Version : Qt::WindowStaysOnTopHint not working properly



swarnika
11th April 2013, 06:49
I have a class named BaseDialog which inherits QFrame. All other dialogs inherits BaseDialog. These dialogs contain 3 QGroupBox which inturn contains QLineEdit and QPushButton.
I used the flag Qt::WindowStaysOnTopHint so that my dialog always remain on top irrespective of the focus.
This flag didn't work on my system(RHEL 6). So I used the flag Qt::X11BypassWindowManagerHint.
Above issue was resolved but dialog stopped taking any keyboard input.
So whenever I enabled my dialog for the first time, i manually activated the dialog using activatewindow().
As soon as I click outside the dialog, it is deactivated. I reimplemented FocusInEvent(). It is working fine if I click at top. But if I click at QGoupBox or QLineEdit inside that dialog, it is not activated.

Please tell me is there any way that this problem can be solved without using activateWindow() with each QLineEdit?(As there as many QLineEdits in every dialog :()

wysota
11th April 2013, 07:27
You should focus on this part:

This flag didn't work on my system(RHEL 6). So I used the flag Qt::X11BypassWindowManagerHint.
Namely why it didn't work on your system. The system doesn't have much to do with this, it is the window manager that either respects this flag or not. Bypassing the WM completely is probably a bad idea since you loose features such as moving the widget around.

swarnika
11th April 2013, 07:31
Sorry, but I meant Window manager only. Even after setting that flag, window didnt stayed at top'. So I used that flag to bypass. (It was suggested in Qt help)

wysota
11th April 2013, 08:28
What window manager are you using?

swarnika
11th April 2013, 11:23
X window Manager.

Added after 37 minutes:

X window Manager Metacity

wysota
11th April 2013, 12:19
Metacity supports this flag without problems.

swarnika
11th April 2013, 12:26
But it is not working in my case. Can you please tell me what might be other reasons?

wysota
11th April 2013, 17:03
I have no idea. Show your code.

swarnika
12th April 2013, 06:34
I am providing you code for BaseDialog class.

I ran my application in another system using X window manager compiz-gtk. It is working fine in that system.

swarnika
13th April 2013, 06:49
I have observed one more thing.

My application contains a main widget(QWidget). When this dialog pops up on the application, this flag doesnt seem to work. But if I minimize my application, dialog always stays at top hint.

wysota
13th April 2013, 08:33
Please show your code. What you have shown so far is of little value.