You will need to use signal and slot to do so. You can read about it here

Connect the clicked() signal of the button in form1 to a slot of the widget/object managing the mainfrom, and in this slot set the text of the QLabel.