I have the following code:
if(collision == 1)
{
painter->setBrush(QColor(Qt::red));
painter->setPen(QColor(Qt::black));
painter->drawEllipse(QPoint(boundingRect().x() + (boundingRect().width() / 1.7),
boundingRect().y() + (boundingRect().width() / 2.1)),
boundingRect().width() / 5,
boundingRect().height() / 10);
/*THERE SHOUD BE THE TIME GAP AND THEN DO*/
collision = 0;
}
I want to use this code to paint red ellipse, but only for few seconds (after collision). Therefore I have to make time gap or delay between two parts of this code. The problem here is that I do not know how to do it.
I tried sleep() or wait() or:
QTime dieTime= QTime::currentTime().addSecs(1);
while( QTime::currentTime() < dieTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
but these STOP or PAUSE whole PROGRAM I just want to delay execution of "collision = 0" Any ideas?