Commit 90656975 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Support .qrc files in the qml2puppet

The code model knows about .qrc files and has a mapping
that we forward to the qml2puppet.
Support for .qrc was broken when introducing the QmlPrivateGate.

Change-Id: I22d1c1add65d0c9a914e471dbe51ef505f308494
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent 184a9d15
...@@ -130,6 +130,7 @@ NodeInstanceServer::NodeInstanceServer(NodeInstanceClientInterface *nodeInstance ...@@ -130,6 +130,7 @@ NodeInstanceServer::NodeInstanceServer(NodeInstanceClientInterface *nodeInstance
connect(m_childrenChangeEventFilter.data(), &Internal::ChildrenChangeEventFilter::childrenChanged, this, &NodeInstanceServer::emitParentChanged); connect(m_childrenChangeEventFilter.data(), &Internal::ChildrenChangeEventFilter::childrenChanged, this, &NodeInstanceServer::emitParentChanged);
nodeInstanceServerInstance = this; nodeInstanceServerInstance = this;
Internal::QmlPrivateGate::registerNotifyPropertyChangeCallBack(notifyPropertyChangeCallBackPointer); Internal::QmlPrivateGate::registerNotifyPropertyChangeCallBack(notifyPropertyChangeCallBackPointer);
Internal::QmlPrivateGate::registerFixResourcePathsForObjectCallBack();
} }
NodeInstanceServer::~NodeInstanceServer() NodeInstanceServer::~NodeInstanceServer()
......
...@@ -790,6 +790,10 @@ ComponentCompleteDisabler::~ComponentCompleteDisabler() ...@@ -790,6 +790,10 @@ ComponentCompleteDisabler::~ComponentCompleteDisabler()
DesignerSupport::enableComponentComplete(); DesignerSupport::enableComponentComplete();
} }
void registerFixResourcePathsForObjectCallBack()
{
}
} // namespace QmlPrivateGate } // namespace QmlPrivateGate
} // namespace Internal } // namespace Internal
} // namespace QmlDesigner } // namespace QmlDesigner
...@@ -127,6 +127,8 @@ public: ...@@ -127,6 +127,8 @@ public:
void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &)); void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &));
void registerFixResourcePathsForObjectCallBack();
} // namespace QmlPrivateGate } // namespace QmlPrivateGate
} // namespace Internal } // namespace Internal
} // namespace QmlDesigner } // namespace QmlDesigner
...@@ -137,6 +137,25 @@ QVariant fixResourcePaths(const QVariant &value) ...@@ -137,6 +137,25 @@ QVariant fixResourcePaths(const QVariant &value)
} }
void fixResourcePathsForObject(QObject *object)
{
if (qgetenv("QMLDESIGNER_RC_PATHS").isEmpty())
return;
PropertyNameList propertyNameList = propertyNameListForWritableProperties(object);
foreach (const PropertyName &propertyName, propertyNameList) {
QQmlProperty property(object, QString::fromUtf8(propertyName), QQmlEngine::contextForObject(object));
const QVariant value = property.read();
const QVariant fixedValue = fixResourcePaths(value);
if (value != fixedValue) {
property.write(fixedValue);
}
}
}
QObject *createComponent(const QUrl &componentUrl, QQmlContext *context) QObject *createComponent(const QUrl &componentUrl, QQmlContext *context)
{ {
return QQuickDesignerSupportItems::createComponent(componentUrl, context); return QQuickDesignerSupportItems::createComponent(componentUrl, context);
...@@ -396,6 +415,11 @@ ComponentCompleteDisabler::~ComponentCompleteDisabler() ...@@ -396,6 +415,11 @@ ComponentCompleteDisabler::~ComponentCompleteDisabler()
DesignerSupport::enableComponentComplete(); DesignerSupport::enableComponentComplete();
} }
void registerFixResourcePathsForObjectCallBack()
{
QQuickDesignerSupportItems::registerFixResourcePathsForObjectCallBack(&fixResourcePathsForObject);
}
} // namespace QmlPrivateGate } // namespace QmlPrivateGate
} // namespace Internal } // namespace Internal
} // namespace QmlDesigner } // namespace QmlDesigner
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment