属于QT的《世界,你好!》
截图:#-------------------------------------------------
#
# Project created by QtCreator 2010-11-09T20:49:24
#
#-------------------------------------------------
QT += core
TARGET = untitled
CONFIG += app
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
以上是工程文件的配置,下面是源代码:
#include<QtGui/QApplication>
#include<QtGui/QWidget>
#include<QtGui/QLabel>
#include<QtCore/QTextCodec>
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));
QWidget* pWidget = new QWidget;
QLabel label(pWidget);
label.setText(QObject::tr("世界,你好!"));
pWidget->show();
return app.exec();
}
[ 本帖最后由 hackerjiang 于 2010-11-10 12:42 编辑 ]