From c9b140eb7e10bf583f69b88f4c2049233b94e6db Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Tue, 31 May 2022 15:49:50 +0300 Subject: [PATCH] QmlDesigner: Correct asset to material editor dnd behavior Only check the first asset when dnd multiple assets to be in sync with the dnd handling in the QML side after drop. Change-Id: I32ecf6be87284dc8e32f51f674ba082fab7cad7a Reviewed-by: Miikka Heikkinen --- .../components/materialeditor/materialeditorview.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp index d231ba1e510..29b07bb3b6d 100644 --- a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp +++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include @@ -819,13 +818,10 @@ void MaterialEditorView::dragStarted(QMimeData *mimeData) if (!mimeData->hasFormat(Constants::MIME_TYPE_ASSETS)) return; - const QStringList assetPaths = QString::fromUtf8(mimeData->data(Constants::MIME_TYPE_ASSETS)).split(','); - bool isImage = Utils::anyOf(assetPaths, [] (const QString &assetPath) { - QString assetType = AssetsLibraryWidget::getAssetTypeAndData(assetPath).first; - return assetType == Constants::MIME_TYPE_ASSET_IMAGE; - }); + const QString assetPath = QString::fromUtf8(mimeData->data(Constants::MIME_TYPE_ASSETS)).split(',')[0]; + QString assetType = AssetsLibraryWidget::getAssetTypeAndData(assetPath).first; - if (!isImage) // only image assets are dnd supported + if (assetType != Constants::MIME_TYPE_ASSET_IMAGE) // currently only image assets have dnd-supported properties return; highlightSupportedProperties();