Convert QList<int> to QString
General and Desktop
2
Posts
2
Posters
18.5k
Views
1
Watching
-
wrote on 6 Jul 2012, 14:01 last edited by
Hi,
At the moment i am working on my first big project. But now i'm stuck, i need to convert a QList<int> to a QString. The String should be like this: "int,int,int,int". I need to convert it for saving the list in a database. I tried it with a QListIterator, but it doesnt work. Hope u understand what i mean;)
-
wrote on 6 Jul 2012, 14:05 last edited by
@
QList<int> list;
QString string;
...
...
...
for(int i=0; i<list.size(); i++)
{
string += QString::number(list[i]);
if(i<list.size()-1)
string += "," ;
}
@
1/2