How to change string into QString?

NeverAgain picture NeverAgain · Nov 29, 2009 · Viewed 235.1k times · Source

What is the most basic way to do it?

Answer

sth picture sth · Nov 29, 2009

If compiled with STL compatibility, QString has a static method to convert a std::string to a QString:

std::string str = "abc";
QString qstr = QString::fromStdString(str);