Adding time elapsed instead of just updating
I have on my dialog lineEdit which displays a time elapsed after certain operation finished it's work. So the code structure is following:
void some_f()
{
QTime time;
time.start();
My_Class::do_operation();//this is static fnc
line_edit->setText(QString::number(time.elapsed()));
}
What I cannot understand is how on ea开发者_Python百科rth this is possible:
While debugging all seems ok, every time this fnc is invoked the time elapsed is different but similar (within same range). Strange things happen when this isn't in debug mode. It looks like time elapsed is ADDED TO PREVIOUS result (previous time). How/why to fix it?
精彩评论