forked from qt-creator/qt-creator
ProjectExplorer: Fix initial top level expansion of projects
For freshly created projects using the json wizard, this expands the outermost level of that project's entry in the project tree. This intentionally does not trigger when reloading from existing sessions do honor a user's choice after collapsing that item manually. Fixes: QTCREATORBUG-17800 Change-Id: I101efaea84e68a4e769c803918652a1447805b2b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -354,6 +354,7 @@ void JsonWizard::openFiles(const JsonWizard::GeneratorFiles &files)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
result.project()->setNeedsInitialExpansion(true);
|
||||||
openedSomething = true;
|
openedSomething = true;
|
||||||
}
|
}
|
||||||
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
|
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
|
||||||
|
@@ -160,6 +160,7 @@ public:
|
|||||||
Core::Id m_id;
|
Core::Id m_id;
|
||||||
bool m_isParsing = false;
|
bool m_isParsing = false;
|
||||||
bool m_hasParsingData = false;
|
bool m_hasParsingData = false;
|
||||||
|
bool m_needsInitialExpansion = false;
|
||||||
std::unique_ptr<Core::IDocument> m_document;
|
std::unique_ptr<Core::IDocument> m_document;
|
||||||
std::unique_ptr<ProjectNode> m_rootProjectNode;
|
std::unique_ptr<ProjectNode> m_rootProjectNode;
|
||||||
std::unique_ptr<ContainerNode> m_containerNode;
|
std::unique_ptr<ContainerNode> m_containerNode;
|
||||||
@@ -306,6 +307,16 @@ void Project::setActiveTarget(Target *target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Project::needsInitialExpansion() const
|
||||||
|
{
|
||||||
|
return d->m_needsInitialExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Project::setNeedsInitialExpansion(bool needsExpansion)
|
||||||
|
{
|
||||||
|
d->m_needsInitialExpansion = needsExpansion;
|
||||||
|
}
|
||||||
|
|
||||||
Target *Project::target(Core::Id id) const
|
Target *Project::target(Core::Id id) const
|
||||||
{
|
{
|
||||||
return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::id, id));
|
return Utils::findOrDefault(d->m_targets, Utils::equal(&Target::id, id));
|
||||||
|
@@ -189,6 +189,9 @@ public:
|
|||||||
}, recv, this);
|
}, recv, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool needsInitialExpansion() const;
|
||||||
|
void setNeedsInitialExpansion(bool needsInitialExpansion);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
void fileListChanged();
|
void fileListChanged();
|
||||||
|
@@ -239,6 +239,10 @@ void FlatModel::addOrRebuildProjectModel(Project *project)
|
|||||||
if (m_trimEmptyDirectories)
|
if (m_trimEmptyDirectories)
|
||||||
trimEmptyDirectories(container);
|
trimEmptyDirectories(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (project->needsInitialExpansion())
|
||||||
|
m_toExpand.insert(expandDataForNode(container->m_node));
|
||||||
|
|
||||||
if (container->childCount() == 0) {
|
if (container->childCount() == 0) {
|
||||||
auto projectFileNode = std::make_unique<FileNode>(project->projectFilePath(),
|
auto projectFileNode = std::make_unique<FileNode>(project->projectFilePath(),
|
||||||
FileType::Project, false);
|
FileType::Project, false);
|
||||||
|
Reference in New Issue
Block a user