diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.cpp b/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.cpp index 8ccd7b8fad7..d358425a1a3 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.cpp +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.cpp @@ -103,6 +103,19 @@ void TextureEditorContextObject::setMajorVersion(int majorVersion) emit majorVersionChanged(); } +QString TextureEditorContextObject::activeDragSuffix() const +{ + return m_activeDragSuffix; +} + +void TextureEditorContextObject::setActiveDragSuffix(const QString &suffix) +{ + if (m_activeDragSuffix != suffix) { + m_activeDragSuffix = suffix; + emit activeDragSuffixChanged(); + } +} + bool TextureEditorContextObject::hasActiveTimeline() const { return m_hasActiveTimeline; diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.h b/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.h index 2ad65821281..cc479e5092e 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.h +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorcontextobject.h @@ -42,6 +42,8 @@ class TextureEditorContextObject : public QObject Q_PROPERTY(QQmlPropertyMap *backendValues READ backendValues WRITE setBackendValues NOTIFY backendValuesChanged) + Q_PROPERTY(QString activeDragSuffix READ activeDragSuffix NOTIFY activeDragSuffixChanged) + public: TextureEditorContextObject(QQmlContext *context, QObject *parent = nullptr); @@ -95,6 +97,9 @@ public: bool hasSingleModelSelection() const; void setHasSingleModelSelection(bool b); + QString activeDragSuffix() const; + void setActiveDragSuffix(const QString &suffix); + bool hasAliasExport() const { return m_aliasExport; } void setSelectedMaterial(const ModelNode &matNode); @@ -126,6 +131,7 @@ signals: void hasQuick3DImportChanged(); void hasMaterialLibraryChanged(); void hasSingleModelSelectionChanged(); + void activeDragSuffixChanged(); private: QUrl m_specificsUrl; @@ -152,6 +158,8 @@ private: bool m_hasSingleModelSelection = false; ModelNode m_selectedTexture; + + QString m_activeDragSuffix; }; } // QmlDesigner diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp b/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp index 37dd6c3ffa9..9384c9baf75 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditorview.cpp @@ -821,10 +821,15 @@ void QmlDesigner::TextureEditorView::highlightSupportedProperties(bool highlight QTC_ASSERT(metaInfo.isValid(), return); for (const QString &propName : propNames) { - if (metaInfo.property(propName.toUtf8()).propertyType().isQtQuick3DTexture()) { // TODO: support dropping to texture source + if (metaInfo.property(propName.toUtf8()).propertyType().isQtQuick3DTexture()) { QObject *propEditorValObj = propMap.value(propName).value(); PropertyEditorValue *propEditorVal = qobject_cast(propEditorValObj); propEditorVal->setHasActiveDrag(highlight); + } else if (metaInfo.property(propName.toUtf8()).propertyType().isUrl()) { + QObject *propEditorValObj = propMap.value(propName).value(); + PropertyEditorValue *propEditorVal = qobject_cast(propEditorValObj); + if (propEditorVal) + propEditorVal->setHasActiveDrag(highlight); } } } @@ -841,6 +846,9 @@ void TextureEditorView::dragStarted(QMimeData *mimeData) return; highlightSupportedProperties(); + + const QString suffix = "*." + assetPath.split('.').last().toLower(); + m_qmlBackEnd->contextObject()->setActiveDragSuffix(suffix); } void TextureEditorView::dragEnded()