Skip to content

Commit

Permalink
fix the naming of gates in modulemodel
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia authored and Julia committed Nov 16, 2023
1 parent 73da074 commit 7810c67
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/gui/include/gui/module_model/module_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>true</b> 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
Expand Down
15 changes: 15 additions & 0 deletions plugins/gui/src/module_model/module_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions plugins/gui/src/netlist_relay/netlist_relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7810c67

Please sign in to comment.