Skip to content

Commit

Permalink
Fix registry dependency in getComponentByName(); fixes #380
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3xdh committed Nov 23, 2023
1 parent 3d411fd commit 4db706b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion qucs/schematic.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ protected slots:
Component* searchSelSubcircuit();
Component* selectedComponent(int, int);
void deleteComp(Component*);
Component* getComponentByName(const QString& compname);
Component* getComponentByName(const QString& compname) const;

void oneLabel(Node*);
int placeNodeLabel(WireLabel*);
Expand Down
8 changes: 5 additions & 3 deletions qucs/schematic_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2860,10 +2860,12 @@ void Schematic::deleteComp(Component *c)
Components->removeRef(c); // delete component
}

Component* Schematic::getComponentByName(const QString& compname)
Component *Schematic::getComponentByName(const QString& compname) const
{
for(Component *pc = DocComps.first(); pc != nullptr; pc = DocComps.next()) {
if (pc->Name == compname) return pc;
for(Component *pc = Components->first(); pc != nullptr; pc = Components->next()) {
if (pc->Name.toLower() == compname.toLower()) {
return pc;
}
}
return nullptr;
}
Expand Down

0 comments on commit 4db706b

Please sign in to comment.