I would suggest taking a look at QElapsedTimer. This class allows you to start a "count up" timer.
One of the methods of the class is elapsed() which returns the number of milliseconds since the timer was started.
By knowing how long you want to allow (total time perhaps) and using an elapsed timer with elapsed() the difference between the two will be the remaining time, in milliseconds.
To convert it to a nice human readable form there are lots of ways but you could simply code up (not the prettiest code, downloaded from a stack overflow post):
QString ConvertMStoHumanTime( qint64 ms, bool showDays, bool showMS )
{
QString Result;
double interval;
qint64 intval;
// Days
interval = 24.0 * 60.0 * 60.0 * 1000.0;
intval = (qint64)trunc((double)ms / interval);
if( intval<0 )
intval = 0;
ms -= (qint64)trunc(intval * interval);
qint32 days = intval;
// Hours
interval = 60.0 * 60.0 * 1000.0;
intval = (qint64)trunc((double)ms / interval);
if( intval<0 )
intval = 0;
ms -= (qint64)trunc(intval * interval);
qint32 hours = intval;
// Minutes
interval = 60.0 * 1000.0;
intval = (qint64)trunc((double)ms / interval);
if( intval<0 )
intval = 0;
ms -= (qint64)trunc(intval * interval);
qint32 minutes = intval;
// Seconds
interval = 1000.0;
intval = (qint64)trunc((double)ms / interval);
if( intval<0 )
intval = 0;
ms -= (qint64)trunc(intval * interval);
qint32 seconds = intval;
// Whatever is left over is milliseconds
char buffer[25];
memset( buffer, 0, 25 );
if( showDays )
{
if( days<10 )
sprintf_s( buffer, "%d", days );
Result.append( QString("%1d ").arg(buffer) );
}
if( hours<10 )
sprintf_s( buffer, "0%d", hours );
else
sprintf_s( buffer, "%d", hours );
Result.append( QString("%1:").arg(buffer) );
if( minutes<10 )
sprintf_s( buffer, "0%d", minutes );
else
sprintf_s( buffer, "%d", minutes );
Result.append( QString("%1:").arg(buffer) );
if( seconds<10 )
sprintf_s( buffer, "0%d", seconds );
else
sprintf_s( buffer, "%d", seconds );
Result.append( QString("%1").arg(buffer) );
if( showMS )
{
if( ms<10 )
sprintf_s( buffer, "00%d", ms );
else if( ms<100 )
sprintf_s( buffer, "0%d", ms );
else
sprintf_s( buffer, "%d", ms );
Result.append( QString(".%1").arg(buffer) );
}
return Result;
}