How to undo Qt.FramelessWindowHint from a QMainWindow?

284 Views Asked by At

The application that I am trying to make needs a frameless window in the first stage, then I need to set it framed back.

so I need to inactivate the following line --> self.setWindowFlag(Qt.FramelessWindowHint)

I searched a lot but I had no satisfying answer. Can you please help me, guys?

Thanks in advance.

1

There are 1 best solutions below

1
On BEST ANSWER

Hope you are almost there, inside your mainwindow init, First you have to add this line while initialization,

Flags = QtCore.Qt.QWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTop)
self.setWindowFlags(Flags)

Later you can set None to windowflags. Hope this helps.