我想更改QInputDialog
框中按钮(确定、取消)的文本。我怎样才能做到这一点?
我想使用 Python 的 gettext 来进行翻译,而不是 Qt Linguist。
# Set maximum file size
def maximumFilesize(self):
# Get user input
maxsize, ok = QtGui.QInputDialog.getInt(self, "Maximum file size",
"Enter maximum file size in bytes:", self.maxsize, 1, 1073741824)
# If OK was clicked...
if ok:
if maxsize <= 0:
message = "Maximum file size cannot be less than 1."
QtGui.QMessageBox.critical(self, "Error", message)
return False
# Set new maximum file size
self.maxsize = maxsize