QmlDesigner: Update resources file system model on model attach

Removed the update from old places.
ViewManager::attachItemLibraryView one was never called and
the other DesignDocument::updateFileName one gets called incorrectly
on any file rename, not just the currently open one.

Change-Id: I822ced6fe32dd9625d605e33046c808eb2272028
Fixes: QDS-2721
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-09-04 17:45:19 +03:00
parent d09ea40c25
commit 0b6be2f93d
3 changed files with 2 additions and 3 deletions

View File

@@ -207,8 +207,6 @@ void DesignDocument::updateFileName(const Utils::FilePath & /*oldFileName*/, con
if (m_inFileComponentModel)
m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName.toString()));
viewManager().setItemLibraryViewResourcePath(newFileName.toFileInfo().absolutePath());
emit displayNameChanged(displayName());
}

View File

@@ -32,6 +32,7 @@
#include <bindingproperty.h>
#include <nodelistproperty.h>
#include <utils/algorithm.h>
#include <qmldesignerplugin.h>
#include "metainfo.h"
namespace QmlDesigner {
@@ -75,6 +76,7 @@ void ItemLibraryView::modelAttached(Model *model)
model->attachView(m_importManagerView);
m_hasErrors = !rewriterView()->errors().isEmpty();
m_widget->setFlowMode(QmlItemNode(rootModelNode()).isFlowView());
setResourcePath(QmlDesignerPlugin::instance()->documentManager().currentDesignDocument()->fileName().toFileInfo().absolutePath());
}
void ItemLibraryView::modelAboutToBeDetached(Model *model)

View File

@@ -224,7 +224,6 @@ void ViewManager::detachViewsExceptRewriterAndComponetView()
void ViewManager::attachItemLibraryView()
{
setItemLibraryViewResourcePath(currentDesignDocument()->fileName().toFileInfo().absolutePath());
currentModel()->attachView(&d->itemLibraryView);
}