将其与 QtCore.QEventLoop() 链接后无法单击 QRadioButton [英] Unable to click on QRadioButton after linking it with QtCore.QEventLoop()

查看:45
本文介绍了将其与 QtCore.QEventLoop() 链接后无法单击 QRadioButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我遇到了必须在 for 循环中选中/取消选中 QRadioButton 的情况.这是链接

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?

解决方案

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

这篇关于将其与 QtCore.QEventLoop() 链接后无法单击 QRadioButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆