With Qt under Gnome 3, Xfce and Unity, a full-screen window with a child window does not remain on top

I have a full screen Qt based application. Full-screen applications should always be on top, because otherwise, part of the window will be blocked. I want to have child windows in the frameless full-screen window (special dialogs, ..). These child windows should appear on top of the full-screen window. There is not much point in showing them below.

A short, self-sufficient example:

from PySide import QtGui, QtCore app = QtGui.QApplication([]) window = QtGui.QWidget(f=QtCore.Qt.WindowStaysOnTopHint) child_window = QtGui.QWidget(window, f=QtCore.Qt.Window) child_window.resize(400, 300) layout = QtGui.QVBoxLayout(window) exit = QtGui.QPushButton('Exit') exit.clicked.connect(app.exit) layout.addWidget(exit) create = QtGui.QPushButton('Create child window') create.clicked.connect(child_window.show) layout.addWidget(create) layout.addStretch() window.showFullScreen() app.exec_() 

It is written in Python and tested in Python 3.X + PySide 1.2.2 (Qt 4.8) + Ubuntu 14.04 (Unity desktop) or Windows 7. However, converting to C ++ Qt (or PyQt) should be simple.

The observation is that on Windows everything is as described at the beginning. Qt.WindowsStaysOnTopHint not required, but on Ubuntu it is.

In Ubuntu, I see that initially the full-screen main window is on top of everything, but as soon as a child dialog is created , the usual desktop windows (top and left bars) are displayed above the full-screen full-screen window blocking parts of the view! As soon as the child window closes, the full-screen window is again displayed at the top.

The question now is, if there is something that can be done to have a full-screen window that sits on top and child windows on Ubuntu and with Qt?

Different behavior between Windows and Linux is also not satisfactory, as OS code should be avoided whenever possible.


Further:

Using an overview of the available desktop environment on Ubuntu , I installed several environments and tested them.

KDE, Lubuntu (Lxde?) And Openbox work as expected (and equally for Windows). The main window remains at the top when the full screen is displayed, and child windows are displayed above.

However, for Gnome-Shell (Gnome 3), Xfce, Unity, and Awesome, the desktop decoration remains at the top of the full-screen window for children. Xfce and Unity behave exactly the same, Gnome and Awesome even have some minor additional issues.

+6
source share
1 answer

Have you tried what the documentation offers ?

Qt :: WindowStaysOnTopHint 0x00040000 Tells the window system that the window should remain on top of all other windows. Note that some window managers on X11 must also pass Qt :: X11BypassWindowManagerHint for this flag to work correctly.

Another thing, why do you want another window to be a child, if this is for you, what should be under the parent?

0
source

Source: https://habr.com/ru/post/971308/


All Articles