forked from qt-creator/qt-creator
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:
@@ -122,11 +122,7 @@ public:
|
||||
PythonProjectNode(PythonProject *project);
|
||||
|
||||
bool showInSimpleTree() const override;
|
||||
|
||||
QList<ProjectAction> supportedActions(Node *node) const override;
|
||||
|
||||
QString addFileFilter() const override;
|
||||
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath) override;
|
||||
|
||||
private:
|
||||
@@ -655,13 +651,6 @@ bool PythonProjectNode::showInSimpleTree() const
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<ProjectAction> PythonProjectNode::supportedActions(Node *node) const
|
||||
{
|
||||
Q_UNUSED(node);
|
||||
//return { AddNewFile, AddExistingFile, AddExistingDirectory, RemoveFile, Rename };
|
||||
return {};
|
||||
}
|
||||
|
||||
QString PythonProjectNode::addFileFilter() const
|
||||
{
|
||||
return QLatin1String("*.py");
|
||||
|
||||
Reference in New Issue
Block a user