Qt 怎么在QWidget上动态创建控件?比如:QPushButton等

2024-11-29 07:46:36
推荐回答(4个)
回答1:

QPushButton *btn = new QPushButton(this);//这个this参数是指你当前的widget

回答2:

QPushButton *btn = new QPushButton(this);
btn->show();

回答3:

new QPushButton(theWidget);

回答4:

QPushButton *button = new QPushButton("&Download", this);