Formatting Numbers
-
[quote author="Andre" date="1333447407"]I guess that this is getting in your way: [quote] If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. [/quote] (from the [[doc:QString]] documentation) I am wondering, why you are not using QTime to format your time: @ QTime t(hours, minutes, seconds); ui->chronoDisplay->setText(QTime::toString("h:mm::ss")); @ [/quote]
Just because I didn't know this possibility... Now that I know it I'm going to try to use it!
Thank you for the advice!
-
I don't think so because either the techniques I've followed, have given me back a string filled with "0", the problem is that the number of 0 returned are more than expected!
Despite the fact I think the problem is different, how can I set the zeroDigit() property to be sure that it returns a '0'?
-
You can't set that value from inside Qt. It is set by the system. However, could you show us what your output is now then? I was under the impression from your previous posts that you did not get enough 0's. Now, you tell us, you get too many. So how does your output look?
-
Ok, this is the result I'm gettim from the simulator after the code is processed.
!http://www.softwareprojects.it/images/blogimages/software/nokiaSimulator.png(nokia simulator image)!
this is the URL of the image:
http://www.softwareprojects.it/images/blogimages/software/nokiaSimulator.png -
[quote author="Andre" date="1333447407"]@ QTime t(hours, minutes, seconds); ui->chronoDisplay->setText(QTime::toString("h:mm::ss")); @ [/quote]
Why this code worked just one time and now it doesn't work again?
This is the error I'm receiving when I try to use the code above
C:\Documents and Settings\tlp31\Documenti\C++_Project\chrono-build-simulator..\chrono\mainwindow.cpp:120: error: cannot call member function 'QString QTime::toString(const QString&) const' without object
and this is the code:
@ QTime t(hours, minutes, seconds);
ui->chronoDisplay->setText(QTime::toString("h:mm::ss"));@