diff --git a/languages/dust3d_zh_CN.ts b/languages/dust3d_zh_CN.ts index e26a90e5..95f912c3 100644 --- a/languages/dust3d_zh_CN.ts +++ b/languages/dust3d_zh_CN.ts @@ -772,6 +772,10 @@ Tips: Iteration 迭代 + + Rename + 重命名 + PartWidget diff --git a/src/parttreewidget.cpp b/src/parttreewidget.cpp index 510f9d4f..90315514 100644 --- a/src/parttreewidget.cpp +++ b/src/parttreewidget.cpp @@ -767,6 +767,7 @@ void PartTreeWidget::showContextMenu(const QPoint &pos, bool shorted) contextMenu.addSeparator(); std::vector groupsActions; + QAction renameAction(tr("Rename"), this); QAction deleteAction(tr("Delete"), this); QAction moveToTopAction(tr("Top"), this); QAction moveUpAction(tr("Up"), this); @@ -845,6 +846,17 @@ void PartTreeWidget::showContextMenu(const QPoint &pos, bool shorted) }; addChildGroupsFunc(QUuid(), 0); + if (nullptr != component && nullptr == part) { + auto componentId = component->id; + connect(&renameAction, &QAction::triggered, [=]() { + auto findItem = m_componentItemMap.find(componentId); + if (findItem != m_componentItemMap.end()) { + editItem(findItem->second); + } + }); + contextMenu.addAction(&renameAction); + } + contextMenu.addSeparator(); deleteAction.setIcon(Theme::awesome()->icon(fa::trash));