我有一个qulonglong变量,我需要把它转换成QChar。
例如,从数字 65 我应该得到 'A'。
或者,如果有一种解决方案可以将其直接转换为 QString 也很好。
最佳答案
您需要的是 QChar
构造函数。
QChar c((short) n);
注意 QChar
提供 16 位字符:
The QChar class provides a 16-bit Unicode character. In Qt, Unicode characters are 16-bit entities without any markup or structure. This class represents such an entity. It is lightweight, so it can be used everywhere. Most compilers treat it like a unsigned short.
qlonglong
是一个 64 位整数,因此在转换为 short
关于Qt - 如何将数字转换为 QChar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9211304/