Gui: Add support for renaming properties
This commit is contained in:
committed by
Kacper Donat
parent
fbc4f450be
commit
5a842e93f5
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user