close bottom window of QMainWindow
-
Hi, I am new in python and pyside6.
I have the following problem:
Using python 3.10 (and pyside 3.9) with this statement:
self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
(self is a QMainwindow object).The window is open correctly, showing just the close button.
When I use python 3.14.2, with pyside 6.10., the window appear with just close botton, but the botton appear disabled.
How I could enable this botton in this version o pyside.
Thanks...
-
Hi and welcome to devnet,
On which OS are you experiencing this ?
Which version of 6.10 do you have ? -
Hi,
Thank you for your reply.
We are working on Windows 11
PySide 6.10.1 -
Can you share a minimal script that shows this behaviour ? That will help people check what is going on.
-
This code, show a window just with the close button, but the botton appear inactive:
import sys
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QMainWindowclass MainWindow(QMainWindow):
def init(self):
super().init()
self.setWindowTitle("Frameless Window Example")
self.resize(400, 200)# Set the window flag to remove the default system title bar and border #self.setWindowFlags(Qt.WindowType.FramelessWindowHint) ~Qt.WindowMinMaxButtonsHint self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)if name == "main":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec()) -
Hey Group,
This statement
self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
Works fine in pyside 6.9 and python 3.10BUT not in pyside 6.10 and python 3.14
After read: https://doc.qt.io/qt-6/qtwidgets-widgets-windowflags-example.html
We changed the statement for:
self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint)Problem resolved
The bad news is that we need change all the application, anyway we need migrate to python 3.14
SGaist, thank you for your time....
-
Hey Group,
This statement
self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint)
Works fine in pyside 6.9 and python 3.10BUT not in pyside 6.10 and python 3.14
After read: https://doc.qt.io/qt-6/qtwidgets-widgets-windowflags-example.html
We changed the statement for:
self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint)Problem resolved
The bad news is that we need change all the application, anyway we need migrate to python 3.14
SGaist, thank you for your time....
@C.J.-Mejias
Given that you say:self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint) # does not work self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint) # does workI would check before executing the first statement what
self.windowFlags()had in it --- did it includeQt.WindowandQt.WindowCloseButtonHintto start with? And for that matter also what it returns after that statement, so that we know what the flags have actually been changed to. All it should be doing is switching off whatever is inQt.WindowMinMaxButtonsHint, which should not be anything to do withQt.WindoworQt.WindowCloseButtonHint. You have not yet discovered whether this change in behaviour is to do with Qt, PySide or Python.