Search code examples
pythonpyqt4pysideqeventloopqradiobutton

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


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?


Solution

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

    enter image description here