我建了個Qt空項目,運行後對話框閃了一下,就不見了,怎麼回事?
```#include
int main(int argc,char *argv[])
{
QApplication a(argc,argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QWidget *widget=new QWidget();
widget->setWindowTitle(QObject::tr("我是widget"));
QLabel *label=new QLabel();
label->setWindowTitle(QObject::tr("我是label"));
label->setText(QObject::tr("label:我是個窗口"));
label->resize(180,20);
QLabel *label2=new QLabel(widget);
label2->setText(QObject::tr("label2:我不是獨立窗口,只是widget的子部件"));
label2->resize(250,20);
label->show();
widget->show();
delete label;
delete widget;
return a.exec();
}
![圖片說明](http://img.ask.csdn.net/upload/201512/08/1449555247_735207.jpg)
delete widget;你都刪掉了,還能出現嗎