#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
,Gcancle(new QPushButton("取消",this))
,EmmEdit(new QLineEdit(this))
{
ui->setupUi(this);
ui->ALogo->setPixmap(QPixmap("://pic//th.jpg"));
ui->ALogo->setScaledContents((true));
ui->Bzhanghao->setPixmap(QPixmap(":/pic/wodepeizhenshi.png"));
ui->Bzhanghao->setScaledContents((true));
ui->Cmima->setPixmap(QPixmap("://pic//passwd.jpg"));
ui->Cmima->setScaledContents((true));
Gcancle->resize(ui->Flogin->width(),ui->Flogin->height());
Gcancle->move(ui->Flogin->x()+ui->Flogin->width()+15,ui->Flogin->y());
connect(Gcancle,SIGNAL(clicked()),this,SLOT(my_slot1()));
this->EmmEdit->resize(ui->DzhEdit->width(),ui->DzhEdit->height());
this->EmmEdit->move(ui->DzhEdit->x(),ui->DzhEdit->y()+ui->DzhEdit->height()+12);
connect(this->EmmEdit,SIGNAL(clicked()),this,SLOT(my_slot2()));
this->EmmEdit->setEchoMode(QLineEdit::Password);
}Widget::~Widget()
{
delete ui;
}
void Widget::my_slot1()
{
this->close();
}
void Widget::my_slot2()
{
QString zh = ui->DzhEdit->text();
QString mm = this->EmmEdit->text();
if(zh == "admin" && mm == "123456")
{
QMessageBox::information(this, "登录", "登陆成功");
this->close();
}else
{
QMessageBox::warning(this, "登录", "登录失败");
ui->DzhEdit->clear();
this->EmmEdit->clear();
}
}