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: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-06-10 16:04:33 +02:00
parent 184a9d1544
commit 9065697572
4 changed files with 31 additions and 0 deletions

View File

@@ -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()

View File

@@ -790,6 +790,10 @@ ComponentCompleteDisabler::~ComponentCompleteDisabler()
DesignerSupport::enableComponentComplete(); DesignerSupport::enableComponentComplete();
} }
void registerFixResourcePathsForObjectCallBack()
{
}
} // namespace QmlPrivateGate } // namespace QmlPrivateGate
} // namespace Internal } // namespace Internal
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -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

View File

@@ -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()
DesignerSupport::enableComponentComplete(); DesignerSupport::enableComponentComplete();
} }
void registerFixResourcePathsForObjectCallBack()
{
QQuickDesignerSupportItems::registerFixResourcePathsForObjectCallBack(&fixResourcePathsForObject);
}
} // namespace QmlPrivateGate } // namespace QmlPrivateGate
} // namespace Internal } // namespace Internal
} // namespace QmlDesigner } // namespace QmlDesigner