Qt作业七

#include "qq_picture.h"
#include "ui_qq_picture.h"

QQ_picture::QQ_picture(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::QQ_picture)
{
    ui->setupUi(this);
    setWindowFlag(Qt::FramelessWindowHint);
    setWindowTitle("QQ聊天");
    //设置动态背景
    QMovie *mv=new QMovie("D:\\QT\\QT\\1.gif");
    ui->label->setMovie(mv);
    mv->start();
    ui->close->setStyleSheet("background-color:transparent");
    //设置密码为隐秘
    ui->lineEdit_3->setEchoMode(QLineEdit::Password);
    //用QT4关闭
    connect(ui->pushButton_2,&QPushButton::clicked,this,&QQ_picture::close_slot);
    //用QT5登录
    connect(ui->pushButton, &QPushButton::clicked, this, &QQ_picture::my_slot);
}

void QQ_picture::close_slot()
{
    close();
}

void QQ_picture::my_slot()
{
    QString name = ui->lineEdit_2->text();
    QString password = ui->lineEdit_3->text();
    if(name == "cmx" && password == "201613320")
    {
        qDebug() << "登录成功";
        close();
    }
    else
    {
        qDebug() << "登录失败";
    }

}

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

你可能感兴趣的:(qt,命令模式,开发语言)