QmlDesigner: Fix empty texture source after drag to map property

FilePath::toUrl() returns an empty url if filepath doesn't have
scheme/host set. This seems to be Qt 6.4 issue.

Worked around the issue by just assigning the relative path directly
without converting to url first, as I don't think there's ever going
to be a case where the filepath will have proper scheme/host here.

Fixes: QDS-8044
Change-Id: I37ae3875bf4386cffc122fd3b030f2b0bf068269
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-10-25 12:38:14 +03:00
parent 866a658b42
commit 001d55e1f0

View File

@@ -515,7 +515,7 @@ void PropertyEditorValue::commitDrop(const QString &path)
Utils::FilePath imagePath = Utils::FilePath::fromString(path); Utils::FilePath imagePath = Utils::FilePath::fromString(path);
Utils::FilePath currFilePath = QmlDesigner::DocumentManager::currentFilePath(); Utils::FilePath currFilePath = QmlDesigner::DocumentManager::currentFilePath();
QmlDesigner::VariantProperty srcProp = texture.variantProperty("source"); QmlDesigner::VariantProperty srcProp = texture.variantProperty("source");
srcProp.setValue(imagePath.relativePathFrom(currFilePath).toUrl()); srcProp.setValue(imagePath.relativePathFrom(currFilePath).toString());
// assign the texture to the property // assign the texture to the property
setExpressionWithEmit(texture.id()); setExpressionWithEmit(texture.id());