Commit 76bf971c authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.PropertyEditor: fix resource urls

When checking for existence we have to convert the url back.

Change-Id: I74536ca88d95b0013239d5ba63db99568e41ab00
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 6956eb1d
...@@ -754,14 +754,14 @@ void PropertyEditor::resetView() ...@@ -754,14 +754,14 @@ void PropertyEditor::resetView()
hierarchy << m_selectedNode.metaInfo().superClasses(); hierarchy << m_selectedNode.metaInfo().superClasses();
foreach (const NodeMetaInfo &info, hierarchy) { foreach (const NodeMetaInfo &info, hierarchy) {
if (QFileInfo(qmlSpecificsFile.toLocalFile()).exists()) if (QFileInfo(fileFromUrl(qmlSpecificsFile)).exists())
break; break;
qmlSpecificsFile = fileToUrl(locateQmlFile(info, fixTypeNameForPanes(info.typeName()) + "Specifics.qml")); qmlSpecificsFile = fileToUrl(locateQmlFile(info, fixTypeNameForPanes(info.typeName()) + "Specifics.qml"));
diffClassName = info.typeName(); diffClassName = info.typeName();
} }
} }
if (!QFileInfo(qmlSpecificsFile.toLocalFile()).exists()) if (!QFileInfo(fileFromUrl(qmlSpecificsFile)).exists())
diffClassName = specificsClassName; diffClassName = specificsClassName;
QString specificQmlData; QString specificQmlData;
...@@ -1050,6 +1050,16 @@ QUrl PropertyEditor::fileToUrl(const QString &filePath) const { ...@@ -1050,6 +1050,16 @@ QUrl PropertyEditor::fileToUrl(const QString &filePath) const {
return fileUrl; return fileUrl;
} }
QString PropertyEditor::fileFromUrl(const QUrl &url) const
{
if (url.scheme() == QLatin1String("qrc")) {
const QString &path = url.path();
return QLatin1String(":") + path;
}
return url.toLocalFile();
}
QUrl PropertyEditor::qmlForNode(const ModelNode &modelNode, QString &className) const QUrl PropertyEditor::qmlForNode(const ModelNode &modelNode, QString &className) const
{ {
if (modelNode.isValid()) { if (modelNode.isValid()) {
......
...@@ -128,6 +128,7 @@ private slots: ...@@ -128,6 +128,7 @@ private slots:
private: //functions private: //functions
QString qmlFileName(const NodeMetaInfo &nodeInfo) const; QString qmlFileName(const NodeMetaInfo &nodeInfo) const;
QUrl fileToUrl(const QString &filePath) const; QUrl fileToUrl(const QString &filePath) const;
QString fileFromUrl(const QUrl &url) const;
QUrl qmlForNode(const ModelNode &modelNode, QString &className) const; QUrl qmlForNode(const ModelNode &modelNode, QString &className) const;
QString locateQmlFile(const NodeMetaInfo &info, const QString &relativePath) const; QString locateQmlFile(const NodeMetaInfo &info, const QString &relativePath) const;
void select(const ModelNode& node); void select(const ModelNode& node);
......
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