Qt equivalent of JavaScript .charCodeAt()
Solved
General and Desktop
-
How to translate this code from JS to Qt:
const str = "你好"; const code = str.charCodeAt(0); console.log(code); // output: 20320
-
Solution:
QString str = "你好"; int code = str[0].unicode(); QHBoxLayout *hbox = new QHBoxLayout(this); QLabel *lbl = new QLabel(QString::number(code)); hbox->addWidget(lbl); setLayout(hbox);
-
8 8Observer8 has marked this topic as solved on