Issue
Im designing a Pyside Qt application and I want to toggle the QtCore.Qt.WindowStaysOnTopHint
window flag in my main window. Setting this hint using this code works fine:
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.show()
but I can't work out how to remove a window flag using Pyside.
Does anybody know how to do this?
Solution
Window flags would normally be OR'd together with the existing flags:
print(int(self.windowFlags()))
self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
print(int(self.windowFlags()))
Then to remove the flag, AND it out using the flag's negation:
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
print(int(self.windowFlags()))
Answered By - ekhumoro
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.