qfedu-qt-level/homework-day1/widget2.cpp

20 lines
435 B
C++
Raw Normal View History

2023-08-08 17:47:59 +08:00
#include "widget2.h"
Widget2::Widget2(QWidget *parent) : QWidget(parent)
{
setWindowTitle("题目2");
setFixedSize(800,600);
btn = new QPushButton("按钮",this);
btn->setFixedSize(200,100);
btn->move(10,10);
label = new QLabel("占位",this);
label->resize(300,200);
label->move(10,130);
connect(btn,&QPushButton::clicked,[&]()->void{
label->setText("1+1=2");
});
}