示例#1
0
 def showEvent(self, ev):
     ret = QDialog.showEvent(self, ev)
     if self.is_question:
         try:
             self.bb.button(QDialogButtonBox.StandardButton.Yes if self.default_yes else QDialogButtonBox.StandardButton.No
                     ).setFocus(Qt.FocusReason.OtherFocusReason)
         except:
             pass  # Buttons were changed
     else:
         self.bb.button(QDialogButtonBox.StandardButton.Ok).setFocus(Qt.FocusReason.OtherFocusReason)
     return ret
示例#2
0
 def showEvent(self, ev):
     ret = QDialog.showEvent(self, ev)
     self.bb.button(QDialogButtonBox.StandardButton.Close).setFocus(
         Qt.FocusReason.OtherFocusReason)
     return ret