From 78893729b406e70e2b5497211d68cbf5cf3f5a23 Mon Sep 17 00:00:00 2001 From: Jeremy HU Date: Thu, 6 Oct 2022 23:18:03 +1100 Subject: [PATCH] Fix selecting component by part id --- application/sources/part_manage_widget.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/sources/part_manage_widget.cc b/application/sources/part_manage_widget.cc index ad26eea5..353b0a39 100644 --- a/application/sources/part_manage_widget.cc +++ b/application/sources/part_manage_widget.cc @@ -126,6 +126,7 @@ void PartManageWidget::selectComponentByPartId(const dust3d::Uuid &partId) QModelIndex index = m_componentPreviewGridWidget->componentListModel()->componentIdToIndex(componentId); if (index.isValid()) { m_componentPreviewGridWidget->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect); + m_componentPreviewGridWidget->scrollTo(index); return; } const auto &component = m_document->findComponent(componentId); @@ -135,6 +136,7 @@ void PartManageWidget::selectComponentByPartId(const dust3d::Uuid &partId) index = m_componentPreviewGridWidget->componentListModel()->componentIdToIndex(componentId); if (index.isValid()) { m_componentPreviewGridWidget->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect); + m_componentPreviewGridWidget->scrollTo(index); return; } dust3dDebug << "Unable to select component:" << componentId.toString();