forked from qt-creator/qt-creator
QmlDesigner: Fix for item library search filter
Without this patch the item library gets into an invalid state if the user enters edit mode with an ative search filter. When going back to design mode the item library is completely empty. This patch clears the filter, so the item library gets properly populated. Change-Id: I21f823b8db820589dedd6ba4e4855678fff49e53 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
4e06822fc5
commit
614689874a
@@ -65,6 +65,7 @@ WidgetInfo ItemLibraryView::widgetInfo()
|
||||
void ItemLibraryView::modelAttached(Model *model)
|
||||
{
|
||||
AbstractView::modelAttached(model);
|
||||
m_widget->clearSearchFilter();
|
||||
m_widget->setModel(model);
|
||||
updateImports();
|
||||
model->attachView(m_importManagerView);
|
||||
@@ -75,6 +76,7 @@ void ItemLibraryView::modelAboutToBeDetached(Model *model)
|
||||
model->detachView(m_importManagerView);
|
||||
|
||||
AbstractView::modelAboutToBeDetached(model);
|
||||
|
||||
m_widget->setModel(0);
|
||||
}
|
||||
|
||||
|
@@ -247,6 +247,11 @@ QString ItemLibraryWidget::qmlSourcesPath()
|
||||
return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/itemLibraryQmlSources");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::clearSearchFilter()
|
||||
{
|
||||
m_filterLineEdit->clear();
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::reloadQmlSource()
|
||||
{
|
||||
QString itemLibraryQmlFilePath = qmlSourcesPath() + QStringLiteral("/ItemsView.qml");
|
||||
|
@@ -86,6 +86,8 @@ public:
|
||||
void setImportsWidget(QWidget *importsWidget);
|
||||
|
||||
static QString qmlSourcesPath();
|
||||
void clearSearchFilter();
|
||||
|
||||
public slots:
|
||||
void setSearchFilter(const QString &searchFilter);
|
||||
void delayedUpdateModel();
|
||||
|
Reference in New Issue
Block a user