Reputation: 388
How can I convert a QVector<char*>
to a QStringList
?
Upvotes: 3
Views: 7944
Reputation: 4453
I think you can try do it in this way (it works for me if I have a QVector<QString>
):
QVector<char*> vector_char;
QStringList myStringList = vector_char.toList();
This code has to work as QStringList
has inherited members of QList
.
Here is somenthing in the documentation: QVector documentation.
And that is all. I hope it can help you.
Upvotes: 1
Reputation: 22346
There is no direct way.
QVector<char*> vector;
QStringList list;
foreach (const char * str, vector) {
list << str;
}
Upvotes: 1