12/08

#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    this->resize(741,611);

    this->setWindowIcon(QIcon(":/pictrue/qq.png"));

    this->setWindowTitle("盗版QQ");

    this->setWindowFlag(Qt::FramelessWindowHint);

    QMovie *mv=new QMovie(":/pictrue/hutao.gif"); //设置动态图
    ui->headplab->setMovie(mv);
    ui->headplab->setScaledContents(true);
    mv->start();

    ui->logelab->setPixmap(QPixmap(":/pictrue/OIP-C.jpg"));
    ui->logelab->setScaledContents(true);

    QMovie *mv1=new QMovie(":/pictrue/qq2.gif");
    ui->backgroundlab->setMovie(mv1);
    ui->backgroundlab->setScaledContents(true);
    mv1->start();

    ui->usrnamelab->setPixmap(QPixmap(":/pictrue/userName.jpg"));
    ui->usrnamelab->setScaledContents(true);
    ui->usrnameline->setPlaceholderText("QQ账号");

    ui->passwdlab->setPixmap(QPixmap(":/pictrue/suo.jpg"));
    ui->passwdlab->setScaledContents(true);
    ui->passwdline->setPlaceholderText("QQ密码");
    ui->passwdline->setEchoMode(QLineEdit::Password);

    connect(ui->endbut,SIGNAL(clicked()),this,SLOT(my_endbut()));
    connect(ui->loginbut,SIGNAL(clicked()),this,SLOT(my_login()));

}

Widget::~Widget()
{
    delete ui;
}

void Widget::my_endbut()
{
    this->close();
}

void Widget::my_login()
{
    if(ui->passwdline->text()=="admin" && ui->usrnameline->text()=="123456")
    {
        qDebug() << "登入成功" ;
        this->close();
    }
    else
    {
        qDebug() << "登入失败" ;
    }
}

12/08_第1张图片

12/08_第2张图片

胡桃摇啊摇

你可能感兴趣的:(命令模式)