qt设置父窗口

1.传参

用指针

   
     MainWindow w;
     QPushButton * pushButton1 = new QPushButton(&w);
     pushButton1->move(100,100);
     pushButton1->show();


用实例

     QPushButton b1(&w) ;
 

2.setParent(&parentt);

     QPushButton b1() ;
     b1.resize(10,10);
     b1.setParent(&w);
发布了24 篇原创文章 · 获赞 8 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/yonggandess/article/details/103230938
今日推荐