Qbs: Do not crash when using simplified project view

Root cause is trying to set the display name on a FolderNode that
is not in the tree yet.

Allow setting the displayname in the constructor and use that new
constructor where it makes sense.

Task-number: QTCREATORBUG-12897
Change-Id: I907e48cac837966e38524bfe88a87ef17d93f0b2
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Tobias Hunger
2014-09-23 13:05:00 +02:00
parent 917aa1064e
commit 06615843df
3 changed files with 11 additions and 7 deletions

View File

@@ -247,10 +247,12 @@ bool FileNode::isGenerated() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
FolderNode::FolderNode(const QString &folderPath, NodeType nodeType) :
FolderNode::FolderNode(const QString &folderPath, NodeType nodeType, const QString &displayName) :
Node(nodeType, folderPath),
m_displayName(QDir::toNativeSeparators(folderPath))
m_displayName(displayName)
{
if (m_displayName.isEmpty())
m_displayName = QDir::toNativeSeparators(folderPath);
}
FolderNode::~FolderNode()