#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setGeometry(500,200, 200, 150);
QPushButton *quit = new QPushButton("Quit",this); //实例化一个按钮 this表示这个按钮属于MainWindow
quit->setGeometry(50, 70, 50, 20); //设置按钮坐标,从左上角向右50,向下70,宽度50, 高度20
QLabel *lab = new QLabel(this);
lab->setText("ID:");
lab->setGeometry(10, 10, 40, 20);
QLineEdit *le = new QLineEdit(this);
le->setText("chensen");
le->setGeometry(50, 10, 100, 20);
QLabel *lb = new QLabel(this);
lb->setText("pass:");
lb->setGeometry(10, 40, 40,20 );
QLineEdit *ple = new QLineEdit(this);
ple->setText("chensen");
ple->setGeometry(50, 40, 100, 20);
QObject::connect(quit,SIGNAL(clicked()), SLOT(close())); //信号和槽的链接
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setGeometry(500,200, 200, 150);
QPushButton *quit = new QPushButton("Quit",this); //实例化一个按钮 this表示这个按钮属于MainWindow
quit->setGeometry(50, 70, 50, 20); //设置按钮坐标,从左上角向右50,向下70,宽度50, 高度20
QLabel *lab = new QLabel(this);
lab->setText("ID:");
lab->setGeometry(10, 10, 40, 20);
QLineEdit *le = new QLineEdit(this);
le->setText("chensen");
le->setGeometry(50, 10, 100, 20);
QLabel *lb = new QLabel(this);
lb->setText("pass:");
lb->setGeometry(10, 40, 40,20 );
QLineEdit *ple = new QLineEdit(this);
ple->setText("chensen");
ple->setGeometry(50, 40, 100, 20);
QObject::connect(quit,SIGNAL(clicked()), SLOT(close())); //信号和槽的链接
}
MainWindow::~MainWindow()
{
delete ui;
}