1. 程式人生 > >QT中QString轉到string型別

QT中QString轉到string型別

std::string QString::toStdString() const

Returns a std::string object with the data contained in this QString. The Unicode data is converted into 8-bit characters using the toUtf8() function.


This operator is mostly useful to pass a QString to a function that accepts a std::string object.


If the QString contains non-Latin1(非拉丁字母) Unicode characters, using this can lead to loss of information