QmlDesigner: Fix possible imports list after import removal

Order of the notifications caused obsolete imports list to be used when
possible imports list was updated, so explicitly update possible
imports on imports change handling, too.

Change-Id: Iea1ae4deecd84c35114a613098e7e5bcf2e86762
Fixes: QDS-2199
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-06-01 13:46:37 +03:00
parent a9619b53f3
commit bd2e67b4f7

View File

@@ -79,13 +79,17 @@ void ImportManagerView::modelAboutToBeDetached(Model *model)
AbstractView::modelAboutToBeDetached(model);
}
void ImportManagerView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
void ImportManagerView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &removedImports)
{
if (m_importsWidget) {
m_importsWidget->setImports(model()->imports());
// setImports recreates labels, so we need to update used imports, as it is not guaranteed
// usedImportsChanged notification will come after this.
m_importsWidget->setUsedImports(model()->usedImports());
// setPossibleImports done in response to possibleImportsChanged comes before importsChanged,
// which causes incorrect "already used" filtering to be applied to possible imports list,
// so update the possible imports list here, too.
m_importsWidget->setPossibleImports(model()->possibleImports());
}
}