我需要主窗口中的一个字符串显示在对话框上,我遇到了一些问题......
这是我的代码:
class Ui_MainWindow(QtGui.QMainWindow):
drive_signal = QtCore.pyqtSignal(str)
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(459, 280)
..... #non relevant code
.....
drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1][1:]
self.drive_combo.clear()
self.drive_combo.addItems(drives)
self.drive_signal.emit(self.drive_combo.currentText())
.....
.....
class SubDialog(QtGui.QDialog):
def setupUi(self, Dialog):
Dialog.setWindowTitle(Ui_MainWindow.drive_signal.connect())
Dialog.resize(532, 285)
.....
.....
但我收到此错误:
AttributeError: 'PyQt4.QtCore.pyqtSignal' object has no attribute 'connect'
有什么帮助吗?