我有以下代码:Qt - 需要递归重绘,怎么样?
paintGL()
{
if(mouse_was_clicked)
{
... do the color picking with openGL to identify a clicked element
... !!! now I need to call again paintGL() to switch the selected element from the
old one to the new one but I can't create a recursive cycle!
}
else
{
... normal code to draw the scene and the selected element in red ...
}
}
随着线提示,我需要一种方法来再次呼吁油漆事件..有没有办法做到这一点,而无需创建一个潜在的活锁?像推迟一个新的绘画事件?
没有深入了解你在做什么......你可以设置一个标志,以便当它再次回来时,你可以错误的标志,并防止递归? – jdi 2012-07-21 21:30:58