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 <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2022-05-31 15:49:50 +03:00
parent c789186418
commit c9b140eb7e

View File

@@ -50,7 +50,6 @@
#include <coreplugin/messagebox.h>
#include <designmodewidget.h>
#include <qmldesignerplugin.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
@@ -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) {
const QString assetPath = QString::fromUtf8(mimeData->data(Constants::MIME_TYPE_ASSETS)).split(',')[0];
QString assetType = AssetsLibraryWidget::getAssetTypeAndData(assetPath).first;
return assetType == Constants::MIME_TYPE_ASSET_IMAGE;
});
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();