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?

10 Answers
10

Leave a Comment