I try to add a minimize button in QDialog, but I get error: AttributeError: type object 'Qt' has no attribute 'WindowMinimizeButtonHint'
class MyWidget(QDialog):
def __init__(self):
super().__init__()
self.setWindowFlag(Qt.WindowMinimizeButtonHint)
self.setWindowTitle("My QDialog")
self.setGeometry(100, 100, 400, 300)
if __name__ == '__main__':
app = QApplication([])
widget = MyWidget()
widget.show()
app.exec()
In PyQt6 you can no longer use short-form names for enum members. You have to include the enum name. In this case WindowType
self.setWindowFlag(Qt.WindowType.WindowMinimizeButtonHint)