Unsolved How to write a radical symbol in a string list?
-
Hello all,
For a program I need to write a radical symbol is a QStringlist. I found that using ALT+251 (like here √) I can insert it but in main().cpp it doesn't work! How to put that character there please?
-
Well, strings aren't exactly for this, but you can escape the unicode sequence. Something like this:
QStringLiteral("\u221A");
-
Basically it can work, but the compiler doesn't necessarily automatically interpret the source file encoding. You should take care that source file is e.g. UTF-8 encoded and that the compiler handles the file as UTF-8. Most probably, if you already can copy the symbol and see it correctly in your editor, it's in UTF-8 format. In Qt Creator the default encoding is UTF-8, at least for me. In g++ the default should also be UTF-8. If it still doesn't work, you have to give more details. Or just use the unicode codepoint as kshegunov told, it's the easy and safe solution if you have only few such symbols.
-
Just tested: copypasted to Qt Creator, compiled with mingw and √ was correctly visible in the app UI.
-
first I need to recover my file. Then I can test them. Please have a look here
https://forum.qt.io/topic/75431/recover-source-after-power-cut