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

@@ -572,6 +572,24 @@ void PropertyModel::removeProperty(const App::Property& _prop)
}
}
void PropertyModel::renameProperty(const App::Property& _prop)
{
auto prop = const_cast<App::Property*>(&_prop);
auto it = itemMap.find(prop);
if (it == itemMap.end() || !it->second) {
return;
}
PropertyItem* item = it->second;
item->renameProperty(prop);
QModelIndex parent = this->index(item->parent()->row(), 0, QModelIndex());
QModelIndex nameIndex = this->index(item->row(), 0, parent);
QModelIndex dataIndex = this->index(item->row(), 1, parent);
QVector<int> roles;
roles << Qt::DisplayRole;
Q_EMIT dataChanged(nameIndex, dataIndex, roles);
}
void PropertyModel::updateChildren(PropertyItem* item, int column, const QModelIndex& parent)
{
int numChild = item->childCount();