Unable to click on QRadioButton after linking it with QtCore.QEventLoop()

夙愿已清 提交于 2019-12-13 22:14:56

问题


Few days back i had situation where i had to check/uncheck QRadioButton in for loop. Here is the link Waiting in for loop until QRadioButton get checked everytime? After implementing QEventLoop on this, it worked fine until today. Now i have seen my QRadioButton(pass) button allow me to click on it but not the second QRadioButton(fail).

Fail QRadioButton neither gets hang nor disable but its just i am not able to click on it.

My QEventLoop code is :

#QLoopEvent 
self.loop = QtCore.QEventLoop()
self.ui.fail_radio.clicked.connect(self.loop.quit)
self.ui.pass_radio.clicked.connect(self.loop.quit)

Code in the for loop is :

self.ui.question_lbl.setText(self.saveQuestionslist[i])
self.loop.exec_();

if self.ui.fail_radio.isChecked():
    ***Some Code**
    self.radioExclusive()
elif self.ui.pass_radio.isChecked():
     ***Some Code**
    self.radioExclusive()

And this radioExclusive function does this :-

def radioExclusive(self):
        self.ui.pass_radio.setAutoExclusive(False);
        self.ui.fail_radio.setAutoExclusive(False);
        self.ui.pass_radio.setChecked(False)
        self.ui.fail_radio.setChecked(False)
        self.ui.pass_radio.setAutoExclusive(True);
        self.ui.fail_radio.setAutoExclusive(True);

I am not sure at what point this problem is happening?


回答1:


Okay, the issue is not with QEventloop but while developing UI of Radio Pass, Extra Area of pass was shadowing Fail Radio.



来源:https://stackoverflow.com/questions/40804580/unable-to-click-on-qradiobutton-after-linking-it-with-qtcore-qeventloop

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