GUI に PyQt4 を使用するアプリがあります。しかし、信号への接続にいくつかの問題があります。
こんなボタンを作りました
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"