QString::fromStdString(content)
is better since it is more robust. Also note, that if std::string
is encoded in UTF-8, then it should give exactly the same result as QString::fromUtf8(content.data(), int(content.size()))
.
More Related Contents:
- How to change string into QString?
- How to convert QString to std::string?
- QString to char* conversion
- Convert wstring to string encoded in UTF-8
- What encoding does std::string.c_str() use?
- c++ if specific words from string
- Meaning of acronym SSO in the context of std::string
- What is the lifetime of the result of std::string::c_str()?
- No matching function – ifstream open()
- Why is strncpy insecure?
- Efficient string concatenation in C++
- How to remove certain characters from a string in C++?
- String literal matches bool overload instead of std::string
- Concatenate two string literals
- Qt: resizing a QLabel containing a QPixmap while keeping its aspect ratio
- What does the symbol \0 mean in a string-literal?
- How to remove all substrings from a string
- Configuring the GCC compiler switches in Qt, QtCreator, and QMake
- C++ Adding String Literal to Char Literal
- std::string length() and size() member functions
- What is the type of a string literal in C++? [duplicate]
- Open QFile for appending
- QT : Templated Q_OBJECT class
- Read into std::string using scanf
- Where in Qt Creator do I pass arguments to a compiler?
- How can I use C++14 features when building qmake projects?
- How to Compress Slot Calls When Using Queued Connection in Qt?
- Safer but easy-to-use and flexible C++ alternative to sscanf()
- Starting QTimer In A QThread
- How to convert a string of hex values to a string?