|
|
"Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:200502221656.09424.bo@xxxxxxxxxxxxxxxxxxxxxxxx
> Tirsdag den 22. februar 2005 16:20 skrev Duane Hebert:
> > I have some numbers that are INT64 that represent minutes.
> > I want to display them as HHHH:MM format. I'm current using
> > something like
> >
> > Where num is a Q_INT64:
> > QString SomeString = QString("%1:%2").arg(QString::number(num/60,'f',0)
> >
> > .arg(QString::number(num % 60,'f',0)
> >
> > This works except there's no padding. I'm padding it manually
> > but is there a way to use arg() with some sprintf type formatting?
> > Or alternatively, does QString's sprintf support Q_INT64?
>
> Why not use the arg with the integers directly?
>
> QString("%1:%2").arg(num/60, 2, 10, QChar('0'))
> .arg(num%60, 2, 10, QChar('0'))
>
> Works here.
>
> Bo.
QString Buffer = QString("%1").arg(num/60,2,10,QChar('0'));
debug(Buffer.ascii())
Shows:
0.000000000000000000000000000000000000000000000000
QString::setNum: Invalid format char '
I don't see a version of arg() that takes these args (Qt3.4)
--
List archive and information: http://lists.trolltech.com/qt-interest/
|
|