forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -925,6 +925,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
|
|||||||
|
|
||||||
FindExportedCppTypes finder(snapshot);
|
FindExportedCppTypes finder(snapshot);
|
||||||
|
|
||||||
|
bool hasNewInfo = false;
|
||||||
typedef QPair<CPlusPlus::Document::Ptr, bool> DocScanPair;
|
typedef QPair<CPlusPlus::Document::Ptr, bool> DocScanPair;
|
||||||
foreach (const DocScanPair &pair, documents) {
|
foreach (const DocScanPair &pair, documents) {
|
||||||
if (interface.isCanceled())
|
if (interface.isCanceled())
|
||||||
@@ -934,7 +935,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
|
|||||||
const bool scan = pair.second;
|
const bool scan = pair.second;
|
||||||
const QString fileName = doc->fileName();
|
const QString fileName = doc->fileName();
|
||||||
if (!scan) {
|
if (!scan) {
|
||||||
newData.remove(fileName);
|
hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -943,9 +944,11 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
|
|||||||
QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes();
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes();
|
||||||
QHash<QString, QString> contextProperties = finder.contextProperties();
|
QHash<QString, QString> contextProperties = finder.contextProperties();
|
||||||
if (exported.isEmpty() && contextProperties.isEmpty()) {
|
if (exported.isEmpty() && contextProperties.isEmpty()) {
|
||||||
newData.remove(fileName);
|
hasNewInfo = hasNewInfo || newData.remove(fileName) > 0;
|
||||||
} else {
|
} else {
|
||||||
CppData &data = newData[fileName];
|
CppData &data = newData[fileName];
|
||||||
|
// currently we have no simple way to compare, so we assume the worse
|
||||||
|
hasNewInfo = true;
|
||||||
data.exportedTypes = exported;
|
data.exportedTypes = exported;
|
||||||
data.contextProperties = contextProperties;
|
data.contextProperties = contextProperties;
|
||||||
}
|
}
|
||||||
@@ -955,6 +958,9 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface,
|
|||||||
|
|
||||||
QMutexLocker locker(&qmlModelManager->m_cppDataMutex);
|
QMutexLocker locker(&qmlModelManager->m_cppDataMutex);
|
||||||
qmlModelManager->m_cppDataHash = newData;
|
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
|
ModelManager::CppDataHash ModelManager::cppData() const
|
||||||
|
Reference in New Issue
Block a user