1 #include <QApplication>
 2 #include <QLabel>
 3 #include <QtCore/QTextCodec>
 4 #include <Qtgui/QDialog>
 5 #include <Qtextcodec.h>
 6 
 7 
 8 int main(int argc, char **argv)
 9 {
10     QApplication app(argc, argv);
11 
12     QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
13     QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
14     QLabel *label = new QLabel();
15     label->setText(QString::fromUtf8("<h2><i>Hello!</i>"
16                                      "<font color = red>你好!</font></h2>" ));
17     label->show();
18 
19     return app.exec();
20 }

 

相关文章:

  • 2021-04-27
  • 2021-04-24
  • 2021-04-24
  • 2021-06-09
  • 2022-01-11
  • 2022-12-23
  • 2021-04-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-19
  • 2022-01-23
  • 2021-04-27
  • 2021-11-07
  • 2021-07-28
  • 2022-12-23
相关资源
相似解决方案