QmlDesigner: Fix crash when dropping an external asset into a subfolder

Task-number: QDS-4429
Change-Id: I230d34dc923acfb3321cbbca5787376b5c9a7078
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Mahmoud Badri
2021-06-17 14:36:29 +03:00
parent e0c89a91e0
commit 4ed8ee5aea

View File

@@ -232,14 +232,16 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache,
Q_UNUSED(changedDirPath) Q_UNUSED(changedDirPath)
// TODO: find a clever way to only refresh the changed directory part of the model // TODO: find a clever way to only refresh the changed directory part of the model
if (!QApplication::activeModalWidget()) {
m_assetsModel->refresh(); m_assetsModel->refresh();
// reload assets qml so that an overridden file's image shows the new image // reload assets qml so that an overridden file's image shows the new image
QTimer::singleShot(100, [this] { QTimer::singleShot(100, this, [this] {
const QString assetsQmlPath = qmlSourcesPath() + "/Assets.qml"; const QString assetsQmlPath = qmlSourcesPath() + "/Assets.qml";
m_assetsWidget->engine()->clearComponentCache(); m_assetsWidget->engine()->clearComponentCache();
m_assetsWidget->setSource(QUrl::fromLocalFile(assetsQmlPath)); m_assetsWidget->setSource(QUrl::fromLocalFile(assetsQmlPath));
}); });
}
}); });
m_stackedWidget = new QStackedWidget(this); m_stackedWidget = new QStackedWidget(this);