PyQt - QComboBox connection confirmed but function is not being called

扶醉桌前 提交于 2019-12-01 01:05:42

I solved it. As I guessed, it did have to do with the "new style" connection syntax. I'm not entirely sure why the old style was connecting, but not calling the connected function, but it is now working with the following code:

    self.dlg.ui.comboBox.currentIndexChanged['QString'].connect(self.getParameters)
    self.dlg.ui.spinBox_bands.valueChanged.connect(self.getParameters)

For those that don't know (I didn't and couldn't find good docmentation - link?), the ['QString'] argument allows you to select the type of result for overloaded signals. This was important for me as I'm using the type to distinguish between the senders. However, I suppose I should be more explicit and use

sender = self.sender()

in my getParameters function, but this is working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!