[Qt-interest] how do use the timer to calculate the time duration
Ferenc Stelcz
ferenc at stelcz.hu
Mon Jun 22 21:37:32 CEST 2009
Yuvaraj R wrote:
> As per my requirement..
>
> When i am clicking the accept call button that time timer will be starting..
>
> When i am clicking the end call button that time time will be stoping.
>
> if i use the timer->elapsed( method.. it gives the one call duration time
> only..
>
> if i calculate duration for next call , it keep on running ,,, it is not
> resetting ...
>
> How do stop the timer,if once i click the end call button
>
Ok, last try:
you could try *restart()* instead of elapsed(), dunno if it will give you what
you want, or you can try the ugly way ::
for example:
void MyVoipClass::acceptCall()
{
QTime callAcceptedAt = QTime::currentTime();
/*
users are chatting with each other
do your job here
*/
QTime callAbortedAt = QTime::currentTime();
qDebug("Parties were chatting for ( %d ) milliseconds.",
callAcceptedAt.msecsTo(callAbortedAt)
);
//or you can call secsTo to get the call duration in seconds
}
More information about the Qt-interest-old
mailing list