Ok, so you say the names are unique. You could do it this way:

Qt Code:
  1. void CreateCamWindow( QString Name, QString Title ) {
  2. static QMap<QString, CamPanel*> panels;
  3.  
  4. if (!panels.contains(Name)) {
  5. panels.insert(Name, new CamPanel);
  6. }
  7. panels[Name]->setObjectName(Name);
  8. panels[Name]->setGeometry(QRect(161, 14, 250, 200));
  9. panels[Name]->setWindowTitle(Title);
  10. panels[Name]->show();
  11. }
To copy to clipboard, switch view to plain text mode 

But that's only because I have only seen that one function. There are more elegant ways to do the same.