Issue
I need to query the signal related to the 'textEdited' connection and can't find how to.
# How the signal was created
myLineEditWidget.textEdited.connect(theSignalIwantToQuery)
Thank you for your help
Solution
Signals aren't query-able. They instantaneously invoke functions they are connected to. Also the syntax doesn't work like that. It works like this.
Given this code:
def myFunction(self, text):
print text
myLineEditWidget.textEdited.connect(myFunction)
In this case textEdited
is the name of the signal. You can see in the Qt documentation for the QLineEdit
widget it's listed under Signals. This code is connecting it to a function called myFunction()
which is called when the condition occurs. So when the line edit widget has it's text edited, myFunction()
, and any other functions (slots) connected to this signal, will be invoked.
Congratulations on discovering Qt and trying to get to grips with signals and slots though. It does take a little while to get your head round it, but it's well worth it.
Answered By - Simon Hibbs
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.