qt day2


 

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

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setWindowTitle("QQ");
    this->setWindowIcon(QIcon(":/pictrue/qq.png"));
    this->setFixedSize(520,460);

    ui->lab1->setPixmap(QPixmap(":/pictrue/logo.png"));
    ui->lab1->setScaledContents(true);

    ui->let1->setPlaceholderText("QQ账号/手机号/QQ邮箱");
    ui->let2->setEchoMode(QLineEdit::Password);

    connect(ui->btn2,SIGNAL(clicked()),this,SLOT(my_slot()));

    connect(ui->btn1,&QPushButton::clicked,this,&Widget::My_slot);
}

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

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

void Widget::My_slot()
{
    if(ui->let1->text()==QString("admin") && ui->let2->text()==QString("123456"))
    {
        qDebug() << "登录成功";
        this->close();
    }
    else
    {
        qDebug() << "登录失败"; 
        ui->let2->clear();
        
    }
}

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