Fix component renaming
parent
a7f22efd1b
commit
9ca0102b52
|
@ -772,6 +772,10 @@ Tips:
|
|||
<source>Iteration</source>
|
||||
<translation>迭代</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Rename</source>
|
||||
<translation>重命名</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>PartWidget</name>
|
||||
|
|
|
@ -767,6 +767,7 @@ void PartTreeWidget::showContextMenu(const QPoint &pos, bool shorted)
|
|||
contextMenu.addSeparator();
|
||||
|
||||
std::vector<QAction *> 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));
|
||||
|
|
Loading…
Reference in New Issue