int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QLabel *my_test=new QLabel("my_test");
my_test->show(); //问my_test这个窗口怎么显示在 MainWindow窗口中
return a.exec();
}
-------我和下面的方法不行------------------
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QLabel *my_test=new QLabel("my_test");
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(my_test);
w.setLayout(layout);
w.show();
return a.exec();
}