qfedu-qt-level/qtdemo01/mywidget2.cpp

27 lines
581 B
C++
Raw Normal View History

2023-08-07 19:24:59 +08:00
#include "mywidget2.h"
MyWidget2::MyWidget2(QWidget *parent) : QWidget(parent)
{
// 设置窗口的大小
resize(800,640);
setWindowTitle("第二个窗口");
mBtn = new QPushButton("提取输入的内容",this);
// mEdit = new QLineEdit(this);
mEdit = new QLineEdit;
mEdit->setParent(this);
mEdit->setFixedSize(200,50);
mEdit->move(10,10);
mBtn->setFixedSize(200,100);
mBtn->move(10,70);
connect(mBtn,&QPushButton::clicked,this,&MyWidget2::getText);
}
void MyWidget2::getText()
{
// 绑定
qDebug()<<mEdit->text();
}