aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp10
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.h2
-rw-r--r--src/libs/utils/treemodel.cpp7
-rw-r--r--src/libs/utils/treemodel.h11
4 files changed, 24 insertions, 6 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index e5506224bf3..fbd2339105c 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -1295,13 +1295,13 @@ bool rescanExports(const QString &fileName, FindExportedCppTypes &finder,
return hasNewInfo;
}
-void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
+void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &futureInterface,
ModelManagerInterface *qmlModelManager,
CPlusPlus::Snapshot snapshot,
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents)
{
- interface.setProgressRange(0, documents.size());
- interface.setProgressValue(0);
+ futureInterface.setProgressRange(0, documents.size());
+ futureInterface.setProgressValue(0);
CppDataHash newData;
QHash<QString, QList<CPlusPlus::Document::Ptr> > newDeclarations;
@@ -1316,9 +1316,9 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
bool hasNewInfo = false;
typedef QPair<CPlusPlus::Document::Ptr, bool> DocScanPair;
foreach (const DocScanPair &pair, documents) {
- if (interface.isCanceled())
+ if (futureInterface.isCanceled())
return;
- interface.setProgressValue(interface.progressValue() + 1);
+ futureInterface.setProgressValue(futureInterface.progressValue() + 1);
CPlusPlus::Document::Ptr doc = pair.first;
const bool scan = pair.second;
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h
index 98174de4f95..c86177d4879 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.h
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h
@@ -242,7 +242,7 @@ protected:
ModelManagerInterface *modelManager,
QmlJS::Dialect mainLanguage,
bool emitDocChangedOnDisk);
- static void updateCppQmlTypes(QFutureInterface<void> &interface,
+ static void updateCppQmlTypes(QFutureInterface<void> &futureInterface,
ModelManagerInterface *qmlModelManager,
CPlusPlus::Snapshot snapshot,
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents);
diff --git a/src/libs/utils/treemodel.cpp b/src/libs/utils/treemodel.cpp
index b4684eedfe1..2b94d56311c 100644
--- a/src/libs/utils/treemodel.cpp
+++ b/src/libs/utils/treemodel.cpp
@@ -689,6 +689,13 @@ void TreeItem::insertChild(int pos, TreeItem *item)
}
}
+void TreeItem::insertOrderedChild(TreeItem *item,
+ const std::function<bool (const TreeItem *, const TreeItem *)> &cmp)
+{
+ auto where = std::lower_bound(begin(), end(), item, cmp);
+ insertChild(int(where - begin()), item);
+}
+
void TreeItem::removeChildAt(int pos)
{
QTC_ASSERT(0 <= pos && pos < m_children.count(), return);
diff --git a/src/libs/utils/treemodel.h b/src/libs/utils/treemodel.h
index 8e0c4407d2f..63818b27c22 100644
--- a/src/libs/utils/treemodel.h
+++ b/src/libs/utils/treemodel.h
@@ -54,6 +54,9 @@ public:
void prependChild(TreeItem *item);
void appendChild(TreeItem *item);
void insertChild(int pos, TreeItem *item);
+ void insertOrderedChild(TreeItem *item,
+ const std::function<bool(const TreeItem *, const TreeItem *)> &cmp);
+
void removeChildAt(int pos);
void removeChildren();
void sortChildren(const std::function<bool(const TreeItem *, const TreeItem *)> &cmp);
@@ -135,6 +138,14 @@ public:
ParentType *parent() const {
return static_cast<ParentType *>(TreeItem::parent());
}
+
+ void insertOrderedChild(ChildType *item, const std::function<bool(const ChildType *, const ChildType *)> &cmp)
+ {
+ const auto cmp0 = [cmp](const TreeItem *lhs, const TreeItem *rhs) {
+ return cmp(static_cast<const ChildType *>(lhs), static_cast<const ChildType *>(rhs));
+ };
+ TreeItem::insertOrderedChild(item, cmp0);
+ }
};
class QTCREATOR_UTILS_EXPORT StaticTreeItem : public TreeItem