VS QT中添加button事件简易方式

1、首先手动拉一个Push Button和Label控件

Push Button控件的对象名设置为pub_test

2、添加槽函数

public slots:
	void on_pub_test_clicked();

3、实现

void QtGuiApplication1::on_pub_test_clicked()
{
	ui.label->setText("AAAA");
}

最后点击pushbutton后Label变为AAA

猜你喜欢

转载自blog.csdn.net/oMoDao1/article/details/103517258