forked from qt-creator/qt-creator
QmlDesigner: Switch to components view upon model attach
the "add imports" view looks confusing when it appears upon switching from edit mode or welcome screen to design mode. Even worse when it stays after creating a new project. Change-Id: Ibc3ff1adc7f6b653d443fec2b8f1803d6ac56ed9 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -77,6 +77,7 @@ void ItemLibraryView::modelAttached(Model *model)
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
m_widget->clearSearchFilter();
|
||||
m_widget->switchToComponentsView();
|
||||
m_widget->setModel(model);
|
||||
updateImports();
|
||||
if (model)
|
||||
|
@@ -278,7 +278,7 @@ void ItemLibraryWidget::handleAddImport(int index)
|
||||
imports.append(import);
|
||||
model->changeImports(imports, {});
|
||||
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
switchToComponentsView();
|
||||
updateSearch();
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ void ItemLibraryWidget::setModel(Model *model)
|
||||
m_subCompEditMode = subCompEditMode;
|
||||
// Switch out of add module view if it's active
|
||||
if (m_subCompEditMode)
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
switchToComponentsView();
|
||||
emit subCompEditModeChanged();
|
||||
}
|
||||
}
|
||||
@@ -330,6 +330,11 @@ void ItemLibraryWidget::clearSearchFilter()
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "clearSearchFilter");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::switchToComponentsView()
|
||||
{
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::reloadQmlSource()
|
||||
{
|
||||
const QString itemLibraryQmlPath = qmlSourcesPath() + "/ItemsView.qml";
|
||||
|
@@ -73,8 +73,9 @@ public:
|
||||
QList<QToolButton *> createToolBarWidgets();
|
||||
|
||||
static QString qmlSourcesPath();
|
||||
void clearSearchFilter();
|
||||
|
||||
void clearSearchFilter();
|
||||
void switchToComponentsView();
|
||||
void delayedUpdateModel();
|
||||
void updateModel();
|
||||
void updatePossibleImports(const QList<Import> &possibleImports);
|
||||
|
Reference in New Issue
Block a user