ProjectNodes: Handle supported actions one-by-one

Getting the full list for a node can get quite expensive e.g. in
cases of recursive calls of QMakeProjectManager::findPriFile.

However, the FlatModel needs to decide quickly on whether an item
is editable to potentially allow renaming.

So split up QList<Actions> supportedActions() into individual
bool supportsAction(action) calls and make sure Rename is not
on the critical path.

Task-number: QTCREATORBUG-17953
Change-Id: I31841847f8aa7d7b94c63d76ce71efb1c930fa69
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-03-15 15:46:48 +01:00
parent 8410c0bbad
commit bd5e2faa75
24 changed files with 162 additions and 211 deletions

View File

@@ -438,7 +438,7 @@ bool DocumentManager::isoProFileSupportsAddingExistingFiles(const QString &resou
ProjectExplorer::ProjectNode *projectNode = node->parentFolderNode()->asProjectNode();
if (!projectNode)
return false;
if (!projectNode->supportedActions(projectNode).contains(ProjectExplorer::AddExistingFile)) {
if (!projectNode->supportsAction(ProjectExplorer::AddExistingFile, projectNode)) {
qCWarning(documentManagerLog) << "Project" << projectNode->displayName() << "does not support adding existing files";
return false;
}