From 4ed8ee5aeaa3d7b7725de677acb692a5d998558f Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Thu, 17 Jun 2021 14:36:29 +0300 Subject: [PATCH] QmlDesigner: Fix crash when dropping an external asset into a subfolder Task-number: QDS-4429 Change-Id: I230d34dc923acfb3321cbbca5787376b5c9a7078 Reviewed-by: Miikka Heikkinen Reviewed-by: Thomas Hartmann --- .../components/itemlibrary/itemlibrarywidget.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index bf111d6040e..851a445ff30 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -232,14 +232,16 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache, Q_UNUSED(changedDirPath) // TODO: find a clever way to only refresh the changed directory part of the model - m_assetsModel->refresh(); + if (!QApplication::activeModalWidget()) { + m_assetsModel->refresh(); - // reload assets qml so that an overridden file's image shows the new image - QTimer::singleShot(100, [this] { - const QString assetsQmlPath = qmlSourcesPath() + "/Assets.qml"; - m_assetsWidget->engine()->clearComponentCache(); - m_assetsWidget->setSource(QUrl::fromLocalFile(assetsQmlPath)); - }); + // reload assets qml so that an overridden file's image shows the new image + QTimer::singleShot(100, this, [this] { + const QString assetsQmlPath = qmlSourcesPath() + "/Assets.qml"; + m_assetsWidget->engine()->clearComponentCache(); + m_assetsWidget->setSource(QUrl::fromLocalFile(assetsQmlPath)); + }); + } }); m_stackedWidget = new QStackedWidget(this);