思维导图:
作业:
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
QMovie *mov=new QMovie("E:\\1.QQ\\1774024653\\FileRecv\\pictrue\\qq.gif");
ui->logol->setMovie(mov);
mov->start();
ui->logol->setScaledContents(1);
ui->username_button->setPixmap(QPixmap(":/pictrue/login.png"));
ui->username_button->setScaledContents(1);
ui->passward_button->setPixmap(QPixmap(":/pictrue/passwd.jpg"));
ui->passward_button->setScaledContents(1);
ui->username_edit->setPlaceholderText("请输入用户名/注册");
ui->username_edit->setEchoMode(QLineEdit::Normal);
ui->passwardedit->setPlaceholderText("密码");
ui->passwardedit->setEchoMode(QLineEdit::Password);
connect(ui->loginbutton,SIGNAL(clicked()),this,SLOT(my_slot()));
}
void Widget::my_slot(){
QString username=ui->username_edit->text();
QString password=ui->passwardedit->text();
if(username=="admin"&& password=="123456"){
// qDebug()<<"登录成功";
QMessageBox::information(this,"登录状态","登录成功");
this->close();
}else {
// qDebug()<<"密码错误";
QMessageBox::warning(this,"status","登录失败");
ui->passwardedit->clear();
}
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_cancel_button_clicked()
{
this->close();
}