forked from qt-creator/qt-creator
QmlDesigner: Fix Image elements in composed effects when no image source
If image source is empty, we still need to generate the Image element for the effect, as user may set the image source later via effect properties. Change-Id: I3a7641f144f6be78062d24e8219064d050d0e471 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -1403,8 +1403,6 @@ QString EffectComposerModel::valueAsVariable(const Uniform &uniform)
|
||||
// Return name for the image property Image element
|
||||
QString EffectComposerModel::getImageElementName(const Uniform &uniform, bool localFiles)
|
||||
{
|
||||
if (localFiles && uniform.value().toString().isEmpty())
|
||||
return QStringLiteral("null");
|
||||
QString simplifiedName = uniform.name().simplified();
|
||||
simplifiedName = simplifiedName.remove(' ');
|
||||
return QStringLiteral("imageItem") + simplifiedName;
|
||||
@@ -1925,11 +1923,7 @@ QString EffectComposerModel::getQmlImagesString(bool localFiles)
|
||||
for (Uniform *uniform : uniforms) {
|
||||
if (uniform->type() == Uniform::Type::Sampler) {
|
||||
QString imagePath = uniform->value().toString();
|
||||
// For preview, generate image element even if path is empty, as changing uniform values
|
||||
// will not trigger qml code regeneration
|
||||
if (localFiles) {
|
||||
if (imagePath.isEmpty())
|
||||
continue;
|
||||
QFileInfo fi(imagePath);
|
||||
imagePath = fi.fileName();
|
||||
imagesString += QString(" property url %1Url: \"%2\"\n")
|
||||
|
Reference in New Issue
Block a user