QtGui: assorted migrations to QString::asprintf
Change-Id: Ibb177b22064efcad56ace60935e9c8759a87a3c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
08a8a6a842
commit
09205f662e
@ -1129,14 +1129,14 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const
|
||||
while (c != colorMap.end()) {
|
||||
QRgb color = c.key();
|
||||
if (image.format() != QImage::Format_RGB32 && !qAlpha(color))
|
||||
line.sprintf("\"%s c None\"",
|
||||
xpm_color_name(cpp, *c));
|
||||
line = QString::asprintf("\"%s c None\"",
|
||||
xpm_color_name(cpp, *c));
|
||||
else
|
||||
line.sprintf("\"%s c #%02x%02x%02x\"",
|
||||
xpm_color_name(cpp, *c),
|
||||
qRed(color),
|
||||
qGreen(color),
|
||||
qBlue(color));
|
||||
line = QString::asprintf("\"%s c #%02x%02x%02x\"",
|
||||
xpm_color_name(cpp, *c),
|
||||
qRed(color),
|
||||
qGreen(color),
|
||||
qBlue(color));
|
||||
++c;
|
||||
s << ',' << endl << line;
|
||||
}
|
||||
|
@ -505,16 +505,13 @@ QString QColor::name() const
|
||||
|
||||
QString QColor::name(NameFormat format) const
|
||||
{
|
||||
QString s;
|
||||
switch (format) {
|
||||
case HexRgb:
|
||||
s.sprintf("#%02x%02x%02x", red(), green(), blue());
|
||||
break;
|
||||
return QString::asprintf("#%02x%02x%02x", red(), green(), blue());
|
||||
case HexArgb:
|
||||
s.sprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue());
|
||||
break;
|
||||
return QString::asprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue());
|
||||
}
|
||||
return s;
|
||||
return QString();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -87,11 +87,7 @@ void tst_QPixmapCache::insert()
|
||||
if (cacheType) {
|
||||
QBENCHMARK {
|
||||
for (int i = 0 ; i <= 10000 ; i++)
|
||||
{
|
||||
QString tmp;
|
||||
tmp.sprintf("my-key-%d", i);
|
||||
QPixmapCache::insert(tmp, p);
|
||||
}
|
||||
QPixmapCache::insert(QString::asprintf("my-key-%d", i), p);
|
||||
}
|
||||
} else {
|
||||
QBENCHMARK {
|
||||
@ -114,12 +110,8 @@ void tst_QPixmapCache::find()
|
||||
QPixmap p;
|
||||
if (cacheType) {
|
||||
QBENCHMARK {
|
||||
QString tmp;
|
||||
for (int i = 0 ; i <= 10000 ; i++)
|
||||
{
|
||||
tmp.sprintf("my-key-%d", i);
|
||||
QPixmapCache::find(tmp, p);
|
||||
}
|
||||
QPixmapCache::find(QString::asprintf("my-key-%d", i), p);
|
||||
}
|
||||
} else {
|
||||
QBENCHMARK {
|
||||
@ -165,18 +157,10 @@ void tst_QPixmapCache::styleUseCaseComplexKey()
|
||||
if (cacheType) {
|
||||
QBENCHMARK {
|
||||
for (int i = 0 ; i <= 10000 ; i++)
|
||||
{
|
||||
QString tmp;
|
||||
tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200);
|
||||
QPixmapCache::insert(tmp, p);
|
||||
}
|
||||
QPixmapCache::insert(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), p);
|
||||
|
||||
for (int i = 0 ; i <= 10000 ; i++)
|
||||
{
|
||||
QString tmp;
|
||||
tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200);
|
||||
QPixmapCache::find(tmp, p);
|
||||
}
|
||||
QPixmapCache::find(QString::asprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200), p);
|
||||
}
|
||||
} else {
|
||||
QHash<styleStruct, QPixmapCache::Key> hash;
|
||||
|
Loading…
x
Reference in New Issue
Block a user