在将代码从PyQt4转换为PyQt5时,我遇到了两个困难,首先是使用信号和信号的名称创建信号字典 MY_SIGNALS = {
'clicked': SIGNAL ('clicked'),my_control, MY_SIGNALS [received_action], function_exec) 一种解决方案是检查接收到的字符串和小部件 if my_control is QtWidgets.QPushButton
如下所示: for child in self.findChildren(QPushButton):
if rect.intersects(child.geometry( )):我尝试将findChildren(QPushButton)替换为QPixmap,QGraphicsScene,QGraphicsPixmapItem它总是返回空列表。