diff --git a/qucs/schematic.h b/qucs/schematic.h index 01ce20cac..d67a49bae 100644 --- a/qucs/schematic.h +++ b/qucs/schematic.h @@ -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*); diff --git a/qucs/schematic_element.cpp b/qucs/schematic_element.cpp index 63608124a..cd9197854 100644 --- a/qucs/schematic_element.cpp +++ b/qucs/schematic_element.cpp @@ -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; }