diff --git a/plugins/gui/include/gui/module_model/module_model.h b/plugins/gui/include/gui/module_model/module_model.h index f64314886d4..5a2b3714ba8 100644 --- a/plugins/gui/include/gui/module_model/module_model.h +++ b/plugins/gui/include/gui/module_model/module_model.h @@ -212,6 +212,13 @@ namespace hal */ void updateModuleName(const u32 id); + /** + * Updates the ModuleItem for the specified gate. The specified gate MUST be contained in the item model. + * + * @param id - The id of the gate to update + */ + void updateGateName(const u32 id); + /** * Returns true if the item model is currently changed/updated. This is the case while adding and * removing modules to/from the item model. It can be used to ignore certain signals sent by the item model diff --git a/plugins/gui/src/module_model/module_model.cpp b/plugins/gui/src/module_model/module_model.cpp index 8526cdc4bf1..98821047b6a 100644 --- a/plugins/gui/src/module_model/module_model.cpp +++ b/plugins/gui/src/module_model/module_model.cpp @@ -378,6 +378,21 @@ namespace hal Q_EMIT dataChanged(index, index); } + void ModuleModel::updateGateName(u32 id) // SPLIT ??? + { + assert(gNetlist->get_gate_by_id(id)); + + assert(mGateMap.contains(id)); + + ModuleItem* item = mGateMap.value(id); + assert(item); + + item->setName(QString::fromStdString(gNetlist->get_gate_by_id(id)->get_name())); // REMOVE & ADD AGAIN + + QModelIndex index = getIndex(item); + Q_EMIT dataChanged(index, index); + } + ModuleItem* ModuleModel::getItem(u32 id, ModuleItem::TreeItemType type) const { return mModuleItemMaps[(int)type]->value(id); diff --git a/plugins/gui/src/netlist_relay/netlist_relay.cpp b/plugins/gui/src/netlist_relay/netlist_relay.cpp index faa6942fdbb..060a8af897b 100644 --- a/plugins/gui/src/netlist_relay/netlist_relay.cpp +++ b/plugins/gui/src/netlist_relay/netlist_relay.cpp @@ -535,6 +535,7 @@ namespace hal case GateEvent::event::name_changed: { //< no associated_data + mModuleModel->updateGateName(gat->get_id()); gGraphContextManager->handleGateNameChanged(gat); Q_EMIT gateNameChanged(gat);