Hi folks,

I have a question on QstringLists.. I have a list of strings which is produced and in that list, i have a string which can have the same name like..

john_1
john_2
john_1
john_2

How can i ignore the last two strings and show only the first two ones??

here is my code and explanation...

Qt Code:
  1. //this is the list which will see how many category of the names are there
  2. // for example two category :
  3. //1- NameList One
  4. //2- NameList Two
  5.  
  6. QStringList test1 = project->getTest1List();
  7.  
  8. for ( unsigned int i=0; i <test1.size(); i++ )
  9. {
  10.  
  11. // this is the list which will look inside the above two categories and collect
  12. //the names for example :
  13.  
  14. //NameList One: has the following names
  15. //john_1
  16. //john_2
  17.  
  18. //NameList Two: has the following names
  19. //john_1
  20. //john_2
  21. //john_3
  22.  
  23. //I get now the following:
  24. //john_1
  25. //john_2
  26. //john_1
  27. //john_2
  28. //john_3
  29.  
  30. // i want the following results:
  31. //john_1
  32. //john_2
  33. //john_3
  34.  
  35. QStringList totall = test->getfromFunction();
  36. SomethingItem * someItem;
  37.  
  38. someItem->getItem()->setText(NAME, QString("test: %1").arg(totall.size()));
  39. someItem->getItem()->setOpen(false);
  40.  
  41. for ( unsigned int j=0; j <totall.size(); j++ )
  42. {
  43.  
  44. someItem->setName(totall[j]);
  45.  
  46. }
  47. }
To copy to clipboard, switch view to plain text mode