diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 5893c972d71..07e9ec06c12 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -925,6 +925,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface &interface, FindExportedCppTypes finder(snapshot); + bool hasNewInfo = false; typedef QPair DocScanPair; foreach (const DocScanPair &pair, documents) { if (interface.isCanceled()) @@ -934,7 +935,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface &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 &interface, QList exported = finder.exportedTypes(); QHash 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 &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