Clean redundant code in qucs.cpp

When I trying to implement search component function, I saw these strange codes with unnecessary iteration and if-branch. So I do some clean up.
Please review this carefully to make sure I didn't delete something important OAO