Auto scroll to selected part widget

master
Jeremy Hu 2019-10-19 08:02:24 +09:30
parent e370bd5392
commit 2b70f34d16
5 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -2381,6 +2381,9 @@ void SkeletonGraphicsWidget::selectPartAll()
continue;
addItemToRangeSelection(item);
}
if (!choosenPartId.isNull()) {
emit partComponentChecked(choosenPartId);
}
}
void SkeletonGraphicsWidget::selectAll()

View File

@ -414,6 +414,7 @@ signals:
void enableAllPositionRelatedLocks();
void disableAllPositionRelatedLocks();
void shortcutToggleWireframe();
void partComponentChecked(QUuid partId);
public:
SkeletonGraphicsWidget(const SkeletonDocument *document);
std::map<QUuid, std::pair<SkeletonGraphicsNodeItem *, SkeletonGraphicsNodeItem *>> nodeItemMap;