From 6f5debb5f56b9a1ad1c083e3237adc98bd407cf7 Mon Sep 17 00:00:00 2001 From: Amr Essam Date: Fri, 21 Feb 2025 17:19:02 +0200 Subject: [PATCH] QmlDesigner: Fix not loading assets in some cases When user creates new project in the same QDS session, assets view were empty. Fixes: QDS-14523 Change-Id: Ifc56e85b556b73eaf8d29fff031e207e8f9ee182 Reviewed-by: Mahmoud Badri Reviewed-by: Shrief Gabr --- .../assetsLibraryQmlSources/AssetsView.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml b/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml index ed755b35db4..c273424349f 100644 --- a/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml +++ b/share/qtcreator/qmldesigner/assetsLibraryQmlSources/AssetsView.qml @@ -136,8 +136,7 @@ TreeView { // view: make sure we will do an "expand all" (otherwise, the whole tree might // be collapsed, and with our visible root not being the actual root of the tree, // the entire tree would be invisible) - root.lastRowCount = -1 - root.requestedExpandAll = true + root.reset() } function onFileChanged(filePath) @@ -154,6 +153,17 @@ TreeView { } // Connections + // Resets everything to its default state before reusing the widget + function reset() + { + root.lastRowCount = -1 + root.rootPathDepth = 0 + root.rootPathRow = 0 + root.requestedExpandAll = true + // Attempt to force reload + updateRowsTimer.restart() + } + function addCreatedFolder(path) { root.__createdDirectories.push(path)