models: rename a model's display name from the panel context menu

Adds a 'Rename' action to the model (non-group) context menu, mirroring
renameGroup: prompts via QInputDialog, trims, and calls
setModelDisplayName + notifyFederationChanged. The Federation already emits
modelChanged, so the panel item text updates in place.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-10 11:33:37 +10:00
parent 21ba06cd94
commit a63bb999c1
3 changed files with 23 additions and 0 deletions
@@ -321,6 +321,12 @@ ModelsPanel::ModelsPanel(bonsaiviewer::SessionState* session_state,
parent_group_id = idOf(parent_index);
}
QAction* rename = menu.addAction(
components::icons::makeSvgIcon(":/icons/cube.svg"), "Rename");
connect(rename, &QAction::triggered, this, [this, id]() {
commands::renameModel(*session_state_, *this, id);
});
QAction* add_group = menu.addAction(
components::icons::makeSvgIcon(":/icons/folder-plus.svg"), "New Group");
connect(add_group, &QAction::triggered, this, [this, parent_group_id]() {