ext Marc Mutz wrote on 2012-02-21: > > https://codereview.qt-project.org/#change,17062 > > The patch also nicely highlights how and where QString().sprintf() is > used in Qt itself, because it adjusts all callers. > This caught my interest, so I checked some of the callers to see how sprintf was used. It's interesting to see how lots of the callers does not need QString::sprintf(). For instance:
For instance: return QString::asprintf("%d bytes", int(number)); should be: return tr("%n bytes", 0, number); Same here: const QString num = QString::asprintf("%.1f KB/s", bytesPerSecond / 1024.0); should be: const QString num = tr("%1 KB/s").arg(bytesPerSecond/1024.0, 0, 'f', 1); ...And the list goes on (I stopped at qmap.cpp) And lots of the callers that don't need localized strings, could have been replaced with QByteArray::sprintf() instead (well, if the function existed). This leads me to my question: Is there any reason why we cannot move QString::asprintf() to QByteArray::asprintf() instead? cheers, Jan-Arve _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development