diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index d2c25d49f75..cc615797a8a 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -243,6 +243,11 @@ ModelManager::ModelManager(QObject *parent): m_updateCppQmlTypesTimer->setSingleShot(true); connect(m_updateCppQmlTypesTimer, SIGNAL(timeout()), SLOT(startCppQmlTypeUpdate())); + m_asyncResetTimer = new QTimer(this); + m_asyncResetTimer->setInterval(1000); + m_asyncResetTimer->setSingleShot(true); + connect(m_asyncResetTimer, SIGNAL(timeout()), SLOT(resetCodeModel())); + qRegisterMetaType("QmlJS::Document::Ptr"); qRegisterMetaType("QmlJS::LibraryInfo"); qRegisterMetaType("QmlJSTools::SemanticInfo"); @@ -1056,6 +1061,11 @@ void ModelManager::startCppQmlTypeUpdate() m_queuedCppDocuments.clear(); } +void ModelManager::asyncReset() +{ + m_asyncResetTimer->start(); +} + void ModelManager::updateCppQmlTypes(QFutureInterface &interface, ModelManager *qmlModelManager, CPlusPlus::Snapshot snapshot, @@ -1100,7 +1110,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface &interface, qmlModelManager->m_cppDataHash = newData; if (hasNewInfo) // one could get away with re-linking the cpp types... - QMetaObject::invokeMethod(qmlModelManager, "resetCodeModel"); + QMetaObject::invokeMethod(qmlModelManager, "asyncReset"); } ModelManager::CppDataHash ModelManager::cppData() const diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h index 1c42c038829..9f6d2a35f36 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.h +++ b/src/plugins/qmljstools/qmljsmodelmanager.h @@ -141,6 +141,7 @@ private slots: void maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc); void queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan); void startCppQmlTypeUpdate(); + void asyncReset(); private: static bool matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType); @@ -160,6 +161,7 @@ private: QFutureSynchronizer m_synchronizer; QTimer *m_updateCppQmlTypesTimer; + QTimer *m_asyncResetTimer; QHash > m_queuedCppDocuments; QFuture m_cppQmlTypesUpdater; QmlJS::QrcCache m_qrcCache;