Cannot set QDialog modal
-
Running PySide6 under Ubuntu Linux
In my class Dialog(QtDialog) init I call self.setWindowModality(Qt.WindowModal)
and then print(self.windowModality())) which reports: 'WindowModality.WindowModal', but the dialog does NOT stay on top.I can force modal by checking 'Always on Top' in the panel icon.
What did I miss?
-
Most likely, a parent widget.. What Desktop/Windowing system is this?
-
Most likely, a parent widget.. What Desktop/Windowing system is this?
@friedemannkleint said in Cannot set QDialog modal:
What Desktop/Windowing system is this?
$ echo $XDG_SESSION_TYPE
x11But I think your implication is that a Dialog without a parent and cannot go modal over other application windows?
-
@friedemannkleint said in Cannot set QDialog modal:
What Desktop/Windowing system is this?
$ echo $XDG_SESSION_TYPE
x11But I think your implication is that a Dialog without a parent and cannot go modal over other application windows?
@oldbrad
So far as I recall, you should have no trouble having a modal dialog on top of all/any other windows in an application, certainly under Xorg if maybe not under Wayland, and without setting Always on Top. But I think your choice ofself.setWindowModality(Qt.WindowModal)is wrong, that is looking for one parent to be modal to and you are not passing any. As per https://doc.qt.io/qt-6/qt.html#WindowModality-enum you should useQt::ApplicationModalif you are not going to set a parent window for it to be modal against.