PyQt 没有button.clicked.connect 函数?

PyQt no button.clicked.connect function?

我有 python 3.4 的 PyQt4,但出现了这个奇怪的错误。每当我尝试调用 btn.clicked.connect() 时,Pycharm 都会抛出此错误:

Cannot find reference "connect" in "function".

例如:

btn = QtGui.QPushButton("Quit", self)
btn.clicked.connect(QtCore.QCoreApplication.instance().quit)

会抛出这个错误。如何?我有丢失的文件吗?

根据Events and Signals in PyQt4 - PyQt4 Tutorial - ZetCode

PyQt4.5 introduced a new style API for working with signals and slots.

QtCore.QObject.connect(button, QtCore.SIGNAL('clicked()'),self.onClicked)

This is the old style API.

button.clicked.connect(self.onClicked)

The new style adheres more to the Python standards.