You can use window flags to enable/disable features of a window, for example removing controls. See the documentation for all the options Qt Namespace | Qt Core 6.7.2
In the example below I use setWindowFlag() to set the window minimize button flag to False.
from PySide6.QtWidgets import QDialog, QApplication
from PySide6.QtCore import Qt
app = QApplication([])
dlg = QDialog()
dlg.setWindowTitle("My dialog")
dlg.setWindowFlag(Qt.WindowFlags.WindowMinimizeButtonHint, False)
dlg.exec()
This gives me the following window
Note there is no app.exec() here because I’m running the dialog event loop by itself. Just in case that looks odd.
Do you mean Qt Designer? What do you mean by “you need to specify WindowType to be able to select WindowMinimizeButton but it doesn’t work.”, I don’t follow sorry.
I can confirm it works on Windows & macOS. This may be a window manager issue.
No this is from Python code not the Designer and I believe it’s a Linux problem since it appears to work for Windows and Mac. When the code below is executed (self.msgbox.exec()) I wanted the minimize tool button not to show but it’s still showing… same with the maximize. In your Mac window those buttons are still showing as well.
I get you. Yep the minimize button is visible in macOS but is unclickable. The window manager draws the frame & controls so has the control over how it interprets the flags from Qt. It may be that your WM doesn’t respect those flags.
Is the issue that users can minimize the dialog & then not be able to find it again to click OK, leaving the main application blocked?
If that’s the case, you can also set the window to stay on top using the Qt.WindowStaysOnTopHint (on X11 you also need Qt.X11BypassWindowManagerHint). I would have expected this to be enforced by the modal flag, but perhaps not.
It’s just a finicky (visual) thing that when I display a modal custom messagebox I don’t want to show tool buttons that aren’t working. I think it’s a bug (a small one) because when I set a window to be a fixed size the WM hides the Maximize button by default so the same should follow when I execute a Dialog window it should hide both the Maximize / Minimize buttons by default rather than disabling them.
Not a major problem but definitely a bug in my books. Where can I send a bug report to, Riverbank ?