Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Convert char to QString
RIVOPICO last edited by
Sorry for this maybe but how i can convert a char to QString? i was searching and i tried but i couldnt....
VRonin last edited by
Paul Colby last edited by
how i can convert a char to QString?
There's lots of ways, and it really depends on how your
charis encoded. For example, if its a simple ASCII / Latin1 char, then one option is to use QChar, such as:
const char c = 'C'; qDebug() << QString(QChar::fromLatin1(c));
Or, for example, if you mean a
char *to a string of characters, then it may be appropriate to use QString::fromLocal8Bit()
const char * const str = "STR"; qDebug() << QString::fromLocal8Bit(str);
RIVOPICO last edited by RIVOPICO
@VRonin and in qt can be used normal strings like c++. I checked and you can create normal char like c++. What is better QChar or char, strings i couldnt only qstrings. and i am using normal char??
VRonin last edited by VRonin