mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
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:
@@ -187,6 +187,22 @@ void renameGroup(SessionState& session, QWidget& host, const QString& group_id)
|
||||
session.setStatusMessage("Models", "Group renamed");
|
||||
}
|
||||
|
||||
void renameModel(SessionState& session, QWidget& host, const QString& model_id) {
|
||||
const Federation::Model* model = session.federation()->findById(model_id);
|
||||
if (!model) return;
|
||||
|
||||
bool ok = false;
|
||||
const QString name = QInputDialog::getText(
|
||||
&host, "Rename Model", "Model name:", QLineEdit::Normal, model->display_name, &ok);
|
||||
if (!ok) return;
|
||||
const QString trimmed = name.trimmed();
|
||||
if (trimmed.isEmpty()) return;
|
||||
|
||||
session.federation()->setModelDisplayName(model_id, trimmed);
|
||||
session.notifyFederationChanged();
|
||||
session.setStatusMessage("Models", "Model renamed");
|
||||
}
|
||||
|
||||
void moveGroup(SessionState& session, const QString& id, const QString& parent_group_id) {
|
||||
session.federation()->setGroupParent(id, parent_group_id);
|
||||
session.notifyFederationChanged();
|
||||
|
||||
Reference in New Issue
Block a user