在mainwindow.cpp宣告地方加入

#pragmaexecution_character_set("utf-8")

 

 

voidMainWindow::on_pushButton_clicked()
{
       QString str="你好嗎?你好吗?お元気ですか?";
       ui->label->setText(str);
}

 用notepad++開啟mainwindow.cpp

 

 範例程式: HelloWorldTest

 資料參考: http://www.hnmade.com/bbs/thread-12170-1-1.html