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

23 lines
547 B
C++

#include "widget3.h"
Widget3::Widget3(QWidget *parent) : QWidget(parent)
{
setWindowTitle("题目3");
setFixedSize(800,600);
btn = new QPushButton("按钮",this);
btn->setFixedSize(200,100);
btn->move(10,10);
edit1 = new QLineEdit(this);
edit1->move(10,120);
edit2 = new QLineEdit(this);
edit2->move(10,160);
connect(btn,&QPushButton::clicked,[&]()->void{
QString str1 = edit1->text();
QString str2 = edit2->text();
qDebug()<<str1+str2;
});
}