Reputation: 2309
I'm working on a windows program using MFC, currently I use std::string and std::wstring, the problems are I have to convert them from each other and handle encoding everywhere.
The QString API looks very decent, it can handle those problems just in one class, so my questions are:
Upvotes: 2
Views: 687
Reputation: 11311
MFC has its own implementation of the string class: CString https://learn.microsoft.com/en-us/cpp/atl-mfc-shared/using-cstring?view=vs-2019
Upvotes: 1
Reputation: 356
Can I use only QString without depending on whole QT library? Yes you can. You havn't to use other Qt libraries.
QString has a lot useful functions to convert the QString into a other type, like:
std::wstring wString;
wString = 'w';
QString qString = QString::fromStdWString(wString);
std::string sString = qString.toStdString();
const char * cP = sString.c_str();
qString = cP;
wString = qString.toStdWString();
Upvotes: 2