summaryrefslogtreecommitdiff
path: root/src/plugins/qmljstools/qmljsmodelmanager.cpp
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@digia.com>2013-05-21 15:42:02 +0200
committerFawzi Mohamed <fawzi.mohamed@digia.com>2013-05-29 20:13:14 +0200
commit8762dd2ea94e4a2f371b9f1667d8b14352264e6b (patch)
treeb512a272de75b4ab3fb83d16f4886bbd366601b0 /src/plugins/qmljstools/qmljsmodelmanager.cpp
parenta05e63d7b0d277a1fc99761311e6a007789147ac (diff)
downloadqt-creator-8762dd2ea94e4a2f371b9f1667d8b14352264e6b.tar.gz
qmljstools: reset code model after update of exported cpp types
Task-number: QTCREATORBUG-9105 Change-Id: Id0021902985da8e5e7faec23766bb37541d041c0 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src/plugins/qmljstools/qmljsmodelmanager.cpp')
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index 5893c972d7..07e9ec06c1 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -925,6 +925,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
FindExportedCppTypes finder(snapshot);
+ bool hasNewInfo = false;
typedef QPair<CPlusPlus::Document::Ptr, bool> DocScanPair;
foreach (const DocScanPair &pair, documents) {
if (interface.isCanceled())
@@ -934,7 +935,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
const bool scan = pair.second;
const QString fileName = doc->fileName();
if (!scan) {
- newData.remove(fileName);
+ hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
continue;
}
@@ -943,9 +944,11 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes();
QHash<QString, QString> contextProperties = finder.contextProperties();
if (exported.isEmpty() && contextProperties.isEmpty()) {
- newData.remove(fileName);
+ hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
} else {
CppData &data = newData[fileName];
+ // currently we have no simple way to compare, so we assume the worse
+ hasNewInfo = true;
data.exportedTypes = exported;
data.contextProperties = contextProperties;
}
@@ -955,6 +958,9 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
QMutexLocker locker(&qmlModelManager->m_cppDataMutex);
qmlModelManager->m_cppDataHash = newData;
+ if (hasNewInfo)
+ // one could get away with re-linking the cpp types...
+ QMetaObject::invokeMethod(qmlModelManager, "resetCodeModel");
}
ModelManager::CppDataHash ModelManager::cppData() const