qstring to std string code example
Example 1: how to convert qt string to string
QString qs;
// do things
std::cout << qs.toStdString() << std::endl;
Example 2: std::string to qstring
QString str = QString::fromUtf8(content.c_str());
Example 3: qstring to string
QString qs;
// Either this if you use UTF-8 anywhere
std::string utf8_text = qs.toUtf8().constData();
// or this if you're on Windows :-)
std::string current_locale_text = qs.toLocal8Bit().constData();