Python PyQt4连接到信号;textValueChanged();

Python PyQt4连接到信号;textValueChanged();,python,pyqt4,Python,Pyqt4,我有一个使用PyQt4的GUI应用程序。但在连接信号方面存在一些问题 我做了一个这样的纽扣 self.button=QtGui.QPushButton("Load File") QObject.connect( self.button, SIGNAL('clicked ()'), self.clicked ) 它完美地触发了以下功能: def clicked(self): 以同样的方式,我创建了一个输入元素。但是,当我更改文本时,输入元素信号不会触发 s

我有一个使用PyQt4的GUI应用程序。但在连接信号方面存在一些问题

我做了一个这样的纽扣

    self.button=QtGui.QPushButton("Load File") 
    QObject.connect( self.button,   SIGNAL('clicked ()'),     self.clicked )
它完美地触发了以下功能:

def clicked(self):
以同样的方式,我创建了一个输入元素。但是,当我更改文本时,输入元素信号不会触发

    self.filter=QtGui.QInputDialog() #Create the Input Dialog
    self.filter.setInputMode (self.filter.InputMode.TextInput ) #Change the input type to text
    self.filter.setOption(self.filter.InputDialogOption.NoButtons,True) #I don't need the buttons so i have removed them
    self.filter.setLabelText("Filter") #I change the label to "filter"
    self.connect(  self.filter,   QtCore.SIGNAL("textValueChanged()"),     self.filterUpdate ) #I connect to the signal textValueChanged() that should be fired when the text is changed and make it fire the filterUpdate() function
以下内容永远不会被触发:

def filterUpdate(self):
    print "Hello"
这在这里起作用:

from PyQt4 import QtCore, QtGui

import sys

app = QtGui.QApplication(sys.argv)

def filterUpdate():
    print('!')

filter = QtGui.QInputDialog()
filter.setInputMode (filter.TextInput)
filter.setOption(filter.NoButtons, True)
filter.setLabelText("Filter")
filter.textValueChanged.connect(filterUpdate)

filter.show()

sys.exit(app.exec_())
这在这里起作用:

from PyQt4 import QtCore, QtGui

import sys

app = QtGui.QApplication(sys.argv)

def filterUpdate():
    print('!')

filter = QtGui.QInputDialog()
filter.setInputMode (filter.TextInput)
filter.setOption(filter.NoButtons, True)
filter.setLabelText("Filter")
filter.textValueChanged.connect(filterUpdate)

filter.show()

sys.exit(app.exec_())

谢谢沃沃鲁克,那是为我做的=)谢谢沃沃鲁克,那是为我做的=)