aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp7
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp
index 28c17d7561..ca76d45966 100644
--- a/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp
+++ b/src/plugins/qmldesigner/components/materialeditor/materialeditorview.cpp
@@ -767,11 +767,16 @@ void MaterialEditorView::customNotification(const AbstractView *view, const QStr
void QmlDesigner::MaterialEditorView::highlightSupportedProperties(bool highlight)
{
+ if (!m_selectedMaterial.isValid())
+ return;
+
DesignerPropertyMap &propMap = m_qmlBackEnd->backendValuesPropertyMap();
const QStringList propNames = propMap.keys();
+ NodeMetaInfo metaInfo = m_selectedMaterial.metaInfo();
+ QTC_ASSERT(metaInfo.isValid(), return);
for (const QString &propName : propNames) {
- if (propName.endsWith("Map")) {
+ if (metaInfo.propertyTypeName(propName.toLatin1()) == "QtQuick3D.Texture") {
QObject *propEditorValObj = propMap.value(propName).value<QObject *>();
PropertyEditorValue *propEditorVal = qobject_cast<PropertyEditorValue *>(propEditorValObj);
propEditorVal->setHasActiveDrag(highlight);
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
index 867fd9bd65..fd568911ab 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
@@ -518,14 +518,15 @@ bool PropertyEditorValue::idListReplace(int idx, const QString &value)
void PropertyEditorValue::commitDrop(const QString &path)
{
- if (m_modelNode.isSubclassOf("QtQuick3D.Material") && nameAsQString().endsWith("Map")) {
+ if (m_modelNode.isSubclassOf("QtQuick3D.Material")
+ && m_modelNode.metaInfo().propertyTypeName(m_name) == "QtQuick3D.Texture") {
// create a texture node
QmlDesigner::NodeMetaInfo metaInfo = m_modelNode.view()->model()->metaInfo("QtQuick3D.Texture");
QmlDesigner::ModelNode texture = m_modelNode.view()->createModelNode("QtQuick3D.Texture",
metaInfo.majorVersion(),
metaInfo.minorVersion());
texture.validId();
- modelNode().view()->rootModelNode().defaultNodeListProperty().reparentHere(texture);
+ m_modelNode.view()->rootModelNode().defaultNodeListProperty().reparentHere(texture);
// TODO: group textures under 1 node (just like materials)
// set texture source