Gui: Add support for renaming properties

This commit is contained in:
Pieter Hijma
2025-07-17 11:25:19 +02:00
committed by Kacper Donat
parent fbc4f450be
commit 5a842e93f5
8 changed files with 105 additions and 0 deletions

View File

@@ -116,6 +116,9 @@ PropertyView::PropertyView(QWidget *parent)
this->connectPropRemove =
App::GetApplication().signalRemoveDynamicProperty.connect(std::bind
(&PropertyView::slotRemoveDynamicProperty, this, sp::_1));
this->connectPropRename =
App::GetApplication().signalRenameDynamicProperty.connect(std::bind
(&PropertyView::slotRenameDynamicProperty, this, sp::_1, sp::_2));
this->connectPropChange =
App::GetApplication().signalChangePropertyEditor.connect(std::bind
(&PropertyView::slotChangePropertyEditor, this, sp::_1, sp::_2));
@@ -258,6 +261,23 @@ void PropertyView::slotRemoveDynamicProperty(const App::Property& prop)
timer->start(ViewParams::instance()->getPropertyViewTimer());
}
void PropertyView::slotRenameDynamicProperty(const App::Property& prop,
const char* /*oldName*/)
{
App::PropertyContainer* parent = prop.getContainer();
if (propertyEditorData->propOwners.contains(parent)) {
propertyEditorData->renameProperty(prop);
}
else if (propertyEditorView->propOwners.contains(parent)) {
propertyEditorView->renameProperty(prop);
}
else {
return;
}
clearPropertyItemSelection();
timer->start(ViewParams::instance()->getPropertyViewTimer());
}
void PropertyView::slotChangePropertyEditor(const App::Document &, const App::Property& prop)
{
App::PropertyContainer* parent = prop.getContainer();