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()) {
|
while (c != colorMap.end()) {
|
||||||
QRgb color = c.key();
|
QRgb color = c.key();
|
||||||
if (image.format() != QImage::Format_RGB32 && !qAlpha(color))
|
if (image.format() != QImage::Format_RGB32 && !qAlpha(color))
|
||||||
line.sprintf("\"%s c None\"",
|
line = QString::asprintf("\"%s c None\"",
|
||||||
xpm_color_name(cpp, *c));
|
xpm_color_name(cpp, *c));
|
||||||
else
|
else
|
||||||
line.sprintf("\"%s c #%02x%02x%02x\"",
|
line = QString::asprintf("\"%s c #%02x%02x%02x\"",
|
||||||
xpm_color_name(cpp, *c),
|
xpm_color_name(cpp, *c),
|
||||||
qRed(color),
|
qRed(color),
|
||||||
qGreen(color),
|
qGreen(color),
|
||||||
qBlue(color));
|
qBlue(color));
|
||||||
++c;
|
++c;
|
||||||
s << ',' << endl << line;
|
s << ',' << endl << line;
|
||||||
}
|
}
|
||||||
|
@ -505,16 +505,13 @@ QString QColor::name() const
|
|||||||
|
|
||||||
QString QColor::name(NameFormat format) const
|
QString QColor::name(NameFormat format) const
|
||||||
{
|
{
|
||||||
QString s;
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case HexRgb:
|
case HexRgb:
|
||||||
s.sprintf("#%02x%02x%02x", red(), green(), blue());
|
return QString::asprintf("#%02x%02x%02x", red(), green(), blue());
|
||||||
break;
|
|
||||||
case HexArgb:
|
case HexArgb:
|
||||||
s.sprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue());
|
return QString::asprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue());
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return s;
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -87,11 +87,7 @@ void tst_QPixmapCache::insert()
|
|||||||
if (cacheType) {
|
if (cacheType) {
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
for (int i = 0 ; i <= 10000 ; i++)
|
for (int i = 0 ; i <= 10000 ; i++)
|
||||||
{
|
QPixmapCache::insert(QString::asprintf("my-key-%d", i), p);
|
||||||
QString tmp;
|
|
||||||
tmp.sprintf("my-key-%d", i);
|
|
||||||
QPixmapCache::insert(tmp, p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
@ -114,12 +110,8 @@ void tst_QPixmapCache::find()
|
|||||||
QPixmap p;
|
QPixmap p;
|
||||||
if (cacheType) {
|
if (cacheType) {
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
QString tmp;
|
|
||||||
for (int i = 0 ; i <= 10000 ; i++)
|
for (int i = 0 ; i <= 10000 ; i++)
|
||||||
{
|
QPixmapCache::find(QString::asprintf("my-key-%d", i), p);
|
||||||
tmp.sprintf("my-key-%d", i);
|
|
||||||
QPixmapCache::find(tmp, p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
@ -165,18 +157,10 @@ void tst_QPixmapCache::styleUseCaseComplexKey()
|
|||||||
if (cacheType) {
|
if (cacheType) {
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
for (int i = 0 ; i <= 10000 ; i++)
|
for (int i = 0 ; i <= 10000 ; i++)
|
||||||
{
|
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);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0 ; i <= 10000 ; i++)
|
for (int i = 0 ; i <= 10000 ; i++)
|
||||||
{
|
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);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QHash<styleStruct, QPixmapCache::Key> hash;
|
QHash<styleStruct, QPixmapCache::Key> hash;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user