Fix component renaming
parent
a7f22efd1b
commit
9ca0102b52
|
@ -772,6 +772,10 @@ Tips:
|
||||||
<source>Iteration</source>
|
<source>Iteration</source>
|
||||||
<translation>迭代</translation>
|
<translation>迭代</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Rename</source>
|
||||||
|
<translation>重命名</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PartWidget</name>
|
<name>PartWidget</name>
|
||||||
|
|
|
@ -767,6 +767,7 @@ void PartTreeWidget::showContextMenu(const QPoint &pos, bool shorted)
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
|
|
||||||
std::vector<QAction *> groupsActions;
|
std::vector<QAction *> groupsActions;
|
||||||
|
QAction renameAction(tr("Rename"), this);
|
||||||
QAction deleteAction(tr("Delete"), this);
|
QAction deleteAction(tr("Delete"), this);
|
||||||
QAction moveToTopAction(tr("Top"), this);
|
QAction moveToTopAction(tr("Top"), this);
|
||||||
QAction moveUpAction(tr("Up"), this);
|
QAction moveUpAction(tr("Up"), this);
|
||||||
|
@ -845,6 +846,17 @@ void PartTreeWidget::showContextMenu(const QPoint &pos, bool shorted)
|
||||||
};
|
};
|
||||||
addChildGroupsFunc(QUuid(), 0);
|
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();
|
contextMenu.addSeparator();
|
||||||
|
|
||||||
deleteAction.setIcon(Theme::awesome()->icon(fa::trash));
|
deleteAction.setIcon(Theme::awesome()->icon(fa::trash));
|
||||||
|
|
Loading…
Reference in New Issue