summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Runtime/Source/runtime/Qt3DSIScriptBridge.h1
-rw-r--r--src/Runtime/Source/runtime/Qt3DSQmlEngine.cpp15
-rw-r--r--src/Runtime/Source/runtime/q3dsqmlscript.cpp2
3 files changed, 17 insertions, 1 deletions
diff --git a/src/Runtime/Source/runtime/Qt3DSIScriptBridge.h b/src/Runtime/Source/runtime/Qt3DSIScriptBridge.h
index 50b98368..af322319 100644
--- a/src/Runtime/Source/runtime/Qt3DSIScriptBridge.h
+++ b/src/Runtime/Source/runtime/Qt3DSIScriptBridge.h
@@ -160,6 +160,7 @@ public: // Elements
// Use inProvider to create a new table and associate with inElement: currently a render plugin
// element this mimics render plugin as an behavior element
virtual void SetTableForElement(TElement &inElement, IScriptTableProvider &inProvider) = 0;
+ virtual void SetAttribute(TElement *element, const char *attName, const char *value) = 0;
virtual void SetAttribute(const char *element, const char *attName, const char *value) = 0;
virtual void FireEvent(const char *element, const char *evtName) = 0;
virtual void SetDataInputValue(
diff --git a/src/Runtime/Source/runtime/Qt3DSQmlEngine.cpp b/src/Runtime/Source/runtime/Qt3DSQmlEngine.cpp
index 0267a7c1..1c8d5c31 100644
--- a/src/Runtime/Source/runtime/Qt3DSQmlEngine.cpp
+++ b/src/Runtime/Source/runtime/Qt3DSQmlEngine.cpp
@@ -408,6 +408,7 @@ public:
void ProcessCustomCallback(IPresentation *, const SEventCommand &) override {}
void SetTableForElement(TElement &, IScriptTableProvider &) override {}
+ void SetAttribute(TElement *target, const char *attName, const char *value) override;
void SetAttribute(const char *element, const char *attName, const char *value) override;
bool GetAttribute(const char *element, const char *attName, char *value) override;
void FireEvent(const char *element, const char *evtName) override;
@@ -518,6 +519,20 @@ void CQmlEngineImpl::Initialize()
initializeDataInputsInPresentation(*presentations[i], i == 0);
}
+void CQmlEngineImpl::SetAttribute(TElement *target, const char *attName, const char *value)
+{
+ QML_ENGINE_MULTITHREAD_PROTECT_METHOD;
+ if (target) {
+ bool success = CQmlElementHelper::SetAttribute(target, attName, value, false);
+ if (!success) {
+ qCCritical(qt3ds::INVALID_OPERATION)
+ << "CQmlEngineImpl::SetAttribute: "
+ << "failed to set attribute on element"
+ << target << ":" << attName << ":" << value;
+ }
+ }
+}
+
void CQmlEngineImpl::SetAttribute(const char *element, const char *attName, const char *value)
{
QML_ENGINE_MULTITHREAD_PROTECT_METHOD;
diff --git a/src/Runtime/Source/runtime/q3dsqmlscript.cpp b/src/Runtime/Source/runtime/q3dsqmlscript.cpp
index 326d709a..6cc249b7 100644
--- a/src/Runtime/Source/runtime/q3dsqmlscript.cpp
+++ b/src/Runtime/Source/runtime/q3dsqmlscript.cpp
@@ -227,7 +227,7 @@ void Q3DSQmlScript::setAttribute(const QString &handle, const QString &attribute
break;
}
- m_api.SetAttribute(element->m_Path,
+ m_api.SetAttribute(element,
attribute.toUtf8().constData(),
valuePtr);
}