there is a function that returns a string, and its result must be entered into a QListWidget which takes as input QSringList. on the usual operator = between the string and QString the compiler swears
1 answer
To convert from std::string to QString , Qt has a static function QString :: fromStdString . And there is also a QString::fromStdWString() function paired to it.
- it is worth mentioning that
QString::fromStdString()expectsstd::stringin utf-8. If the encoding is different (including Latin-1), then it is better to use various conversion options fromchar *. - Fat-Zer
|