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()
hierarchy << m_selectedNode.metaInfo().superClasses();
foreach (const NodeMetaInfo &info, hierarchy) {
if (QFileInfo(qmlSpecificsFile.toLocalFile()).exists())
if (QFileInfo(fileFromUrl(qmlSpecificsFile)).exists())
break;
qmlSpecificsFile = fileToUrl(locateQmlFile(info, fixTypeNameForPanes(info.typeName()) + "Specifics.qml"));
diffClassName = info.typeName();
}
}
if (!QFileInfo(qmlSpecificsFile.toLocalFile()).exists())
if (!QFileInfo(fileFromUrl(qmlSpecificsFile)).exists())
diffClassName = specificsClassName;
QString specificQmlData;
......@@ -1050,6 +1050,16 @@ QUrl PropertyEditor::fileToUrl(const QString &filePath) const {
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
{
if (modelNode.isValid()) {
......
......@@ -128,6 +128,7 @@ private slots:
private: //functions
QString qmlFileName(const NodeMetaInfo &nodeInfo) const;
QUrl fileToUrl(const QString &filePath) const;
QString fileFromUrl(const QUrl &url) const;
QUrl qmlForNode(const ModelNode &modelNode, QString &className) const;
QString locateQmlFile(const NodeMetaInfo &info, const QString &relativePath) const;
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