QmlDesigner: Convert the form editor preview image to correct format

We were passing the image with premultiplied alpha obtained from
QSGRhiLayer::toImage() to be shown in form editor. This corrupts the
colors in with 3D materials having partially transparent colors.
Converting the image to QImage::Format_ARGB32 format fixes the issue.

Fixes: QDS-7474
Change-Id: Id0b689d7e2d9fc111e98f28b18db0af3ac30041f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-08-26 14:18:05 +03:00
parent 3b3e2e1baa
commit 169ba3b6f7

View File

@@ -489,7 +489,7 @@ QImage Qt5NodeInstanceServer::grabItem(QQuickItem *item)
layer->scheduleUpdate(); layer->scheduleUpdate();
if (layer->updateTexture()) if (layer->updateTexture())
renderImage = layer->toImage(); renderImage = layer->toImage().convertToFormat(QImage::Format_ARGB32);
else else
qWarning() << __FUNCTION__ << "Failed to update layer texture"; qWarning() << __FUNCTION__ << "Failed to update layer texture";