Perhaps QString::arg() with fill char '0'?
Try this:
QString msg = QString("%1").arg(number);
msg = msg.leftJustified(msg.indexOf('.')+3, '0');
msg = msg.left(msg.indexOf('.')+3);
here msg will contains 2 digit after decimal point.
Last edited by rajesh; 4th October 2007 at 12:54. Reason: code modified
Rajesh Kumar Singh
Bangalore, India.
Qt Search
Must Watch:
See how we can connect digital world objects to our day to day life….
if you want only 4 digit then
QString msg = QString("%1").arg(number);
msg = msg.leftJustified(msg.indexOf('.')+3, '0');
msg = msg.left(msg.indexOf('.')+3);
msg = msg.rightJustified(5,'0');
Last edited by rajesh; 4th October 2007 at 12:53. Reason: code added
Rajesh Kumar Singh
Bangalore, India.
Qt Search
Must Watch:
See how we can connect digital world objects to our day to day life….
Bookmarks