我在一个名为 EditName 的类中有这段代码,它继承Ui_MainWindow
自 PyQt5 的 ui 文件
class EditName(Ui_MainWindow):
def __init__(self, window):
self.setupUi(window)
QShortcut(
QKeySequence('Ctrl+1'), self).activated.connect(lambda: self.ComboEditType.setCurrentIndex(0))
当我运行此代码时,它会产生以下错误。我进行了搜索,但没有找到任何解决此错误的方法。
TypeError: arguments did not match any overloaded call:
QShortcut(QWidget): argument 1 has unexpected type 'QKeySequence'
QShortcut(Union[QKeySequence, QKeySequence.StandardKey, str, int], QWidget, member: PYQT_SLOT = 0, ambiguousMember: PYQT_SLOT = 0, context: Qt.ShortcutContext = Qt.WindowShortcut): argument 2 has unexpected type 'EditName'