diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-05-16 14:08:57 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-05-17 11:31:56 +0000 |
commit | 800d5822efe262c1f6cdf9597392bb35791fb0ac (patch) | |
tree | d181d86b244b56dcd43a8159d6069502341d883e /src/plugins/resourceeditor/resourcenode.cpp | |
parent | 3e9f1672b7758ad2942191452f5dc42177c3c172 (diff) |
Resources: Read qrc file contents from file if that is readable
Retrieve the qrc file contents from the file if that is readable. This
is now necessary since the ResourceTopLevelNode now contains the QRC
file contents itself so the QML code model has access to it, even if
a qrc file is actually used.
This fixes one part of QTCREATORBUG-17930
Task-number: QTCREATORBUG-17930
Change-Id: I0e8cc8828062f079d8634882a768ca60331a0e16
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/resourceeditor/resourcenode.cpp')
-rw-r--r-- | src/plugins/resourceeditor/resourcenode.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index 20f67b2eec..354f56c4ee 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -270,12 +270,14 @@ ResourceTopLevelNode::ResourceTopLevelNode(const FileName &filePath, bool genera { setIsGenerated(generated); setIcon(FileIconProvider::icon(filePath.toString())); - if (contents.isEmpty()) { - m_document = new ResourceFileWatcher(this); - DocumentManager::addDocument(m_document); + if (!filePath.isEmpty()) { + QFileInfo fi = filePath.toFileInfo(); + if (fi.isFile() && fi.isReadable()) { + m_document = new ResourceFileWatcher(this); + DocumentManager::addDocument(m_document); + } } else { m_contents = contents; - m_document = nullptr; } FileName base = parent->filePath(); |