ClassView: improvements of performance for flat tree view

Improved lazy loading mechanism. The main problem here was that
fetchMore function creates children items not only for selected
item but also for children items.
When one changed something in code then whole treeview was rebuilt
(and fetchMore function was called).

Replaced using "contains" and operator[] with 'value'.

Task-number: QTCREATORBUG-8813
Task-number: QTCREATORBUG-8801(partially)
Change-Id: If1ab69a0a67ff828275176ad99c3c63d2a1fa4a2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2013-12-04 13:46:12 +01:00
parent c35ad8c62a
commit fa33294f17
10 changed files with 132 additions and 189 deletions

View File

@@ -58,9 +58,10 @@ public:
explicit Parser(QObject *parent = 0);
~Parser();
bool canFetchMore(QStandardItem *item) const;
bool canFetchMore(QStandardItem *item, bool skipRoot = false) const;
void fetchMore(QStandardItem *item, bool skipRoot = false) const;
bool hasChildren(QStandardItem *item) const;
signals:
//! File list is changed
@@ -93,6 +94,9 @@ protected slots:
void onResetDataDone();
protected:
typedef QHash<QString, unsigned>::const_iterator CitCachedDocTreeRevision;
typedef QHash<QString, QStringList>::const_iterator CitCachedPrjFileLists;
void addProject(const ParserTreeItem::Ptr &item, const QStringList &fileList,
const QString &projectId = QString());
@@ -115,11 +119,12 @@ protected:
QStringList addProjectNode(const ParserTreeItem::Ptr &item,
const ProjectExplorer::ProjectNode *node);
QStringList getAllFiles(const ProjectExplorer::ProjectNode *node);
void addFlatTree(const ParserTreeItem::Ptr &item,
const ProjectExplorer::ProjectNode *node);
QStringList projectNodeFileList(const ProjectExplorer::FolderNode *node) const;
ParserTreeItem::Ptr createFlatTree(const QStringList &projectList);
private:
//! Private class data pointer
ParserPrivate *d;