#include<QtGui> int main(int argc, char * argv[]) { QApplication app(argc, argv); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf-8")); QWidget wgt; wgt.setWindowTitle(QString::QString("我也有依靠")); wgt.setGeometry(, , , ); QLabel lbl(&wgt); lbl.setText(QString::QString("我有依靠")); lbl.move(,); QLabel lblAlone; lblAlone.setText("独行侠"); lblAlone.setGeometry(, , , ); wgt.show(); lblAlone.show(); app.exec(); ; }
标签也可以没有父元素