- C/C++ code
#include<QApplication>#include<QtGui>#include<QString>#include<QObject>int main(int argc,char *argv[]){ QApplication app(argc,argv); QWidget *w=NULL; QVBoxLayout *vb=NULL; QLabel *l=NULL;// QPushButton *pb=NULL; QLineEdit *le=NULL; QString pas("\0"); vb->addWidget(l); vb->addWidget(le); vb->addWidget(pb); w->setLayout(vb); l->setText(QObject::tr("QQ2012")); le->setEchoMode(QLineEdit::Password); pb->setText(QObject::tr("Login")); pas=le->text(); w->show(); return app.exec();}
------解决方案--------------------
新建是
QWidget *w = new QWidget;
祝你好运