PDA

View Full Version : QString into QStringList



kais khelifa
14th November 2011, 20:24
Hello,

I'm trying to convert a QString into a QStringList using the split function, but i don't seem to get what's missing in this simple code :


QString string = "a,b,c,d";
QStringList stringList= string.split(",",QString::SkipEmptyParts);

for (int i = 0; i < stringList.size(); i++){

qDebug(stringList.at(i));
}

i get the error : no matching function for call to ‘qDebug(const QString&)’

any one got an idea !!.
K|Z

Lykurg
14th November 2011, 21:30
Maybe there is no function qDebug(const QString&)...

Use
qDebug(stringList.at(i).toUtf8()); or
qDebug() << stringList.at(i);

boudie
14th November 2011, 22:02
Or get rid of the for loop and do


qDebug() << stringList;