在 PyQT5 中创建带有标准按钮的消息框时,我发现其中只有一些具有键盘快捷键。如何在未提供快捷方式的地方添加快捷方式?
例如,这里有一个带有 9 个标准按钮的消息框。其中只有五个有快捷方式:是、否、确定、取消、保存。
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication,QMessageBox
Q = QApplication([])
M = QMessageBox()
M.setWindowTitle( 'What the ...?' )
M.setText( 'eh?' )
M.setStandardButtons( QMessageBox.Ignore | QMessageBox.No | QMessageBox.Yes )
M.setDefaultButton( QMessageBox.No )
M.exec()