Python + pyQT-将参数发送到连接的Signal函数 [英] Python + pyQT - send parameters to the connected Signal function
问题描述
此示例有效:(这里我的函数没有输入参数)
This example works: (Here my function has no input parameters)
QtCore.QObject.connect(ComboJobType1_1, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")) ,self.InputChanged())
但是,我有必要发送一个参数,所以我尝试这样做:(在更新函数以得到一个参数之后):
But, It is necessary for me to send a parameter so I try this: (After updating my function to expect one parameter):
QtCore.QObject.connect(ComboJobType1_1,QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")),self.InputChanged("ComboJobType1_1"))
QtCore.QObject.connect(ComboJobType1_1, QtCore.SIGNAL(_fromUtf8("currentIndexChanged(QString)")) ,self.InputChanged("ComboJobType1_1"))
请注意,第一个示例正在工作,唯一的问题(我想)是向函数发送参数(当我进入函数时,我必须知道comboBox的名称).
Please note that the first example is working, the only problem (I guess) is sending a parameter to my function (I must know the name of the comboBox when I'm in the function).
请咨询... 谢谢! 祝你有美好的一天, 海豚
Please advice... Thank you! Wish you a great day, Dolphin
推荐答案
ref 为我工作,给它一个简单的lambda(将其转换为funciton ref而不是execute吗?
worked for me, tht gives it a simple lambda (turn it to funciton ref instead of execute ?
这篇关于Python + pyQT-将参数发送到连接的Signal函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!