diff --git a/src/documentwindow.cpp b/src/documentwindow.cpp index cdd9320c..689c902c 100644 --- a/src/documentwindow.cpp +++ b/src/documentwindow.cpp @@ -954,6 +954,8 @@ DocumentWindow::DocumentWindow() : connect(partTreeWidget, &PartTreeWidget::addPartToSelection, graphicsWidget, &SkeletonGraphicsWidget::addPartToSelection); + connect(graphicsWidget, &SkeletonGraphicsWidget::partComponentChecked, partTreeWidget, &PartTreeWidget::partComponentChecked); + connect(m_document, &Document::componentNameChanged, partTreeWidget, &PartTreeWidget::componentNameChanged); connect(m_document, &Document::componentChildrenChanged, partTreeWidget, &PartTreeWidget::componentChildrenChanged); connect(m_document, &Document::componentRemoved, partTreeWidget, &PartTreeWidget::componentRemoved); diff --git a/src/parttreewidget.cpp b/src/parttreewidget.cpp index 2aa6b877..1e5b1cdc 100644 --- a/src/parttreewidget.cpp +++ b/src/parttreewidget.cpp @@ -765,6 +765,15 @@ void PartTreeWidget::addComponentChildrenToItem(QUuid componentId, QTreeWidgetIt QTreeWidget::scrollToItem(scrollToItem); } +void PartTreeWidget::partComponentChecked(QUuid partId) +{ + auto item = m_partItemMap.find(partId); + if (item == m_partItemMap.end()) { + return; + } + QTreeWidget::scrollToItem(item->second); +} + void PartTreeWidget::deleteItemChildren(QTreeWidgetItem *item) { auto children = item->takeChildren(); diff --git a/src/parttreewidget.h b/src/parttreewidget.h index 8ace952b..3c144f9e 100644 --- a/src/parttreewidget.h +++ b/src/parttreewidget.h @@ -72,6 +72,7 @@ public slots: void partColorSolubilityChanged(QUuid partId); void partChecked(QUuid partId); void partUnchecked(QUuid partId); + void partComponentChecked(QUuid partId); void groupChanged(QTreeWidgetItem *item, int column); void groupExpanded(QTreeWidgetItem *item); void groupCollapsed(QTreeWidgetItem *item); diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp index 670fbbac..c29af04d 100644 --- a/src/skeletongraphicswidget.cpp +++ b/src/skeletongraphicswidget.cpp @@ -2381,6 +2381,9 @@ void SkeletonGraphicsWidget::selectPartAll() continue; addItemToRangeSelection(item); } + if (!choosenPartId.isNull()) { + emit partComponentChecked(choosenPartId); + } } void SkeletonGraphicsWidget::selectAll() diff --git a/src/skeletongraphicswidget.h b/src/skeletongraphicswidget.h index e3fc2d39..ed99a7a3 100644 --- a/src/skeletongraphicswidget.h +++ b/src/skeletongraphicswidget.h @@ -414,6 +414,7 @@ signals: void enableAllPositionRelatedLocks(); void disableAllPositionRelatedLocks(); void shortcutToggleWireframe(); + void partComponentChecked(QUuid partId); public: SkeletonGraphicsWidget(const SkeletonDocument *document); std::map> nodeItemMap;