forked from qt-creator/qt-creator
QmlDesigner.PropertyEditor: fix resource urls
When checking for existence we have to convert the url back. Change-Id: I74536ca88d95b0013239d5ba63db99568e41ab00 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user