How to convert QString to std::string?
问题 I am trying to do something like this: QString string; // do things... std::cout << string << std::endl; but the code doesn\'t compile. How to output the content of qstring into the console (e.g. for debugging purposes or other reasons)? How to convert QString to std::string ? 回答1: One of the things you should remember when converting QString to std::string is the fact that QString is UTF-16 encoded while std::string ... May have any encodings. So the best would be either: QString qs; //