Fix some deprecation warnings about String::sprintf() and qVariantFromValue()

stylehelper.cpp:216:46: warning: 'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
...
baseenginedebugclient.cpp:124:49: warning: 'QVariant qVariantFromValue(const T&) [with T = QmlDebug::ObjectReference]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations]
...

Change-Id: Iafdb58b8a66f1b0a14342fa5b29e31fc4997a621
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Friedemann Kleint
2019-05-27 17:23:59 +02:00
parent b7280d4986
commit a49175aa29

View File

@@ -209,9 +209,9 @@ static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRe
void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored)
{ {
if (StyleHelper::usePixmapCache()) { if (StyleHelper::usePixmapCache()) {
QString key;
QColor keyColor = baseColor(lightColored); QColor keyColor = baseColor(lightColored);
key.sprintf("mh_vertical %d %d %d %d %d", const QString key = QString::asprintf("mh_vertical %d %d %d %d %d",
spanRect.width(), spanRect.height(), clipRect.width(), spanRect.width(), spanRect.height(), clipRect.width(),
clipRect.height(), keyColor.rgb()); clipRect.height(), keyColor.rgb());
@@ -267,9 +267,9 @@ QRect &rect, bool lightColored)
void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored)
{ {
if (StyleHelper::usePixmapCache()) { if (StyleHelper::usePixmapCache()) {
QString key;
QColor keyColor = baseColor(lightColored); QColor keyColor = baseColor(lightColored);
key.sprintf("mh_horizontal %d %d %d %d %d %d", const QString key = QString::asprintf("mh_horizontal %d %d %d %d %d %d",
spanRect.width(), spanRect.height(), clipRect.width(), spanRect.width(), spanRect.height(), clipRect.width(),
clipRect.height(), keyColor.rgb(), spanRect.x()); clipRect.height(), keyColor.rgb(), spanRect.x());
@@ -309,8 +309,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
QRect r = option->rect; QRect r = option->rect;
int size = qMin(r.height(), r.width()); int size = qMin(r.height(), r.width());
QPixmap pixmap; QPixmap pixmap;
QString pixmapName; const QString pixmapName = QString::asprintf("StyleHelper::drawArrow-%d-%d-%d-%f",
pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f",
element, size, enabled, devicePixelRatio); element, size, enabled, devicePixelRatio);
if (!QPixmapCache::find(pixmapName, &pixmap)) { if (!QPixmapCache::find(pixmapName, &pixmap)) {
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
@@ -351,8 +350,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect)
{ {
if (StyleHelper::usePixmapCache()) { if (StyleHelper::usePixmapCache()) {
QString key; const QString key = QString::asprintf("mh_menu %d %d %d %d %d",
key.sprintf("mh_menu %d %d %d %d %d",
spanRect.width(), spanRect.height(), clipRect.width(), spanRect.width(), spanRect.height(), clipRect.width(),
clipRect.height(), StyleHelper::baseColor().rgb()); clipRect.height(), StyleHelper::baseColor().rgb());