[Qt-interest] Problem with QString.arg()
Allen, Matthew
MAllen at utcretail.com
Wed Apr 8 17:29:12 CEST 2009
I'm getting this error from the compiler:
pdf_viewer.cpp:697: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
/usr/include/QtCore/qstring.h:129: note: candidate 1: QString QString::arg(double, int, char, int, const QChar&) const
/usr/include/QtCore/qstring.h:625: note: candidate 2: QString QString::arg(int, int, int, const QChar&) const
The line it is bitching about is:
tmpString.append(QString("%1").arg((int)i, 2, 10, '0') + "|");
Yes, I just realized that I can put the "|" inside the QString argument but I'm trying to find out what is wrong with the line itself. i is an int and is a counter in a for loop.
Basically, I'm trying to take an int and pad it to 2 digits and zero filled. I'll use sprintf if I have to but I'd rather not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090408/1f9800e3/attachment.html
More information about the Qt-interest-old
mailing list