#include <qtextcodec.h>
#include<QWidget>
#include<QApplication>
#include<QLabel>
#include<QMessageBox>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
setWindowTitle(QString::fromLocal8Bit("你"));
//QWidget::setCaption(QString::fromLocal8Bit("你"));
QLabel *label = new QLabel("<h2><i>hello </i> "
"<font color=red>qt!</font></h2>");
label->show();
return app.exec();
}
setWindowTitle是在哪个头文件啊??
在QT Assistan里面只查到下面这些说明,没有说包含在哪个头文件。
windowTitle : QString
This property holds the window title (caption).
This property only makes sense for top-level widgets, such as windows and dialogs. If no caption has been set, the title is based of the windowFilePath. If neither of these is set, then the title is an empty string.
If you use the windowModified mechanism, the window title must contain a "[*]" placeholder, which indicates where the '*' should appear. Normally, it should appear right after the file name (e.g., "document1.txt[*] - Text Editor"). If the windowModified property is false (the default), the placeholder is simply removed.
Access functions:
QString windowTitle () const
void setWindowTitle ( const QString & )