Qt QString to std::string Conversion: Simple Guide
You can use the toStdString() function to convert a QString to a std::string. Here's an example:
QString qstr = 'Hello, world!';
std::string str = qstr.toStdString();
Note: If the QString contains Unicode characters, toStdString() will convert it to a std::string using UTF-8 encoding. If you need to use a different encoding, use QString::toUtf8() or QTextCodec.
原文地址: https://www.cveoy.top/t/topic/n3SY 著作权归作者所有。请勿转载和采集!