from PyQt5 import QtCore
def on_inTopCheckBox_clicked(self, checked):
if not checked:
dialog.setWindowFlags(QtCore.Qt.Widget) #取消置顶
else:
dialog.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) #置顶
self.show()