Fix division by zero in hellogl_es2 example.

Task-number: QTBUG-37027

Change-Id: Id18ee9c44650de9c434a82d3d10cf48e6ba9e78c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Friedemann Kleint 2014-02-24 11:26:41 +01:00 committed by The Qt Project
parent aac68a9ef3
commit c05e5948a0

View File

@ -308,12 +308,12 @@ void GLWidget::paintGL()
bubble->drawBubble(&painter);
}
QString framesPerSecond;
framesPerSecond.setNum(frames /(time.elapsed() / 1000.0), 'f', 2);
painter.setPen(Qt::white);
painter.drawText(20, 40, framesPerSecond + " fps");
if (const int elapsed = time.elapsed()) {
QString framesPerSecond;
framesPerSecond.setNum(frames /(elapsed / 1000.0), 'f', 2);
painter.setPen(Qt::white);
painter.drawText(20, 40, framesPerSecond + " fps");
}
painter.end();