:db:sStrong
7th August 2006, 11:08
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...
//this is the list which will see how many category of the names are there
// for example two category :
//1- NameList One
//2- NameList Two
QStringList test1 = project->getTest1List();
for ( unsigned int i=0; i <test1.size(); i++ )
{
// this is the list which will look inside the above two categories and collect
//the names for example :
//NameList One: has the following names
//john_1
//john_2
//NameList Two: has the following names
//john_1
//john_2
//john_3
//I get now the following:
//john_1
//john_2
//john_1
//john_2
//john_3
// i want the following results:
//john_1
//john_2
//john_3
QStringList totall = test->getfromFunction();
SomethingItem * someItem;
someItem->getItem()->setText(NAME, QString("test: %1").arg(totall.size()));
someItem->getItem()->setOpen(false);
for ( unsigned int j=0; j <totall.size(); j++ )
{
someItem->setName(totall[j]);
}
}
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...
//this is the list which will see how many category of the names are there
// for example two category :
//1- NameList One
//2- NameList Two
QStringList test1 = project->getTest1List();
for ( unsigned int i=0; i <test1.size(); i++ )
{
// this is the list which will look inside the above two categories and collect
//the names for example :
//NameList One: has the following names
//john_1
//john_2
//NameList Two: has the following names
//john_1
//john_2
//john_3
//I get now the following:
//john_1
//john_2
//john_1
//john_2
//john_3
// i want the following results:
//john_1
//john_2
//john_3
QStringList totall = test->getfromFunction();
SomethingItem * someItem;
someItem->getItem()->setText(NAME, QString("test: %1").arg(totall.size()));
someItem->getItem()->setOpen(false);
for ( unsigned int j=0; j <totall.size(); j++ )
{
someItem->setName(totall[j]);
}
}