Replace use of QString::sprintf
This commit is contained in:
@@ -196,9 +196,8 @@ static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRe
|
||||
void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
||||
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
QString key;
|
||||
QColor keyColor = baseColor(lightColored);
|
||||
key.sprintf("mh_vertical %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb());
|
||||
QString key = QString::asprintf("mh_vertical %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
@@ -253,9 +252,8 @@ static void horizontalGradientHelper(QPainter *p, const QRect &spanRect, const Q
|
||||
void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
||||
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
QString key;
|
||||
QColor keyColor = baseColor(lightColored);
|
||||
key.sprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb(), spanRect.x());
|
||||
QString key = QString::asprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb(), spanRect.x());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
@@ -294,8 +292,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
QRect r = option->rect;
|
||||
int size = qMin(r.height(), r.width());
|
||||
QPixmap pixmap;
|
||||
QString pixmapName;
|
||||
pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio);
|
||||
QString pixmapName = QString::asprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio);
|
||||
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
||||
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
|
||||
image.fill(Qt::transparent);
|
||||
@@ -336,8 +333,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) {
|
||||
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
QString key;
|
||||
key.sprintf("mh_menu %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb());
|
||||
QString key = QString::asprintf("mh_menu %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, &pixmap)) {
|
||||
|
||||
@@ -119,8 +119,8 @@ QString PrettyTime(int seconds) {
|
||||
seconds %= 60;
|
||||
|
||||
QString ret;
|
||||
if (hours) ret.sprintf("%d:%02d:%02d", hours, minutes, seconds);
|
||||
else ret.sprintf("%d:%02d", minutes, seconds);
|
||||
if (hours) ret = QString("%d:%02d:%02d").arg(hours).arg(minutes).arg(seconds);
|
||||
else ret = QString("%d:%02d").arg(minutes).arg(seconds);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -186,11 +186,11 @@ QString PrettySize(quint64 bytes) {
|
||||
if (bytes <= 1000)
|
||||
ret = QString::number(bytes) + " bytes";
|
||||
else if (bytes <= 1000 * 1000)
|
||||
ret.sprintf("%.1f KB", float(bytes) / 1000);
|
||||
ret = QString("%.1f KB").arg(float(bytes) / 1000);
|
||||
else if (bytes <= 1000 * 1000 * 1000)
|
||||
ret.sprintf("%.1f MB", float(bytes) / (1000 * 1000));
|
||||
ret = QString("%.1f MB").arg(float(bytes) / (1000 * 1000));
|
||||
else
|
||||
ret.sprintf("%.1f GB", float(bytes) / (1000 * 1000 * 1000));
|
||||
ret = QString("%.1f GB").arg(float(bytes) / (1000 * 1000 * 1000));
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user