Commit b952d042 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Update item library if error is fixed

If the document has an error (e.g. incomplete type information),
then it is required to update the item library if this error is fixed.

Change-Id: Iee9629879a0d3ee4bbc76dc0701f023e3c12f394
Reviewed-by: Tim Jenssen's avatarTim Jenssen <>
parent fa6caa3b
......@@ -27,6 +27,7 @@
#include "itemlibrarywidget.h"
#include <import.h>
#include <importmanagerview.h>
#include <rewriterview.h>
namespace QmlDesigner {
......@@ -69,6 +70,7 @@ void ItemLibraryView::modelAttached(Model *model)
m_hasErrors = !rewriterView()->errors().isEmpty();
void ItemLibraryView::modelAboutToBeDetached(Model *model)
......@@ -93,6 +95,15 @@ void ItemLibraryView::setResourcePath(const QString &resourcePath)
void ItemLibraryView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
if (m_hasErrors && errors.isEmpty())
/* For some reason we have to call update from the event loop */
QTimer::singleShot(0, m_widget, &ItemLibraryWidget::updateModel);
m_hasErrors = !errors.isEmpty();
void ItemLibraryView::updateImports()
......@@ -50,6 +50,7 @@ public:
void modelAttached(Model *model) override;
void modelAboutToBeDetached(Model *model) override;
void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports) override;
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
void setResourcePath(const QString &resourcePath);
......@@ -59,6 +60,7 @@ protected:
QPointer<ItemLibraryWidget> m_widget;
ImportManagerView *m_importManagerView;
bool m_hasErrors = false;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment