小黑子鉴别界面
#include "mywidget.h"
void MyWidget::bth1()
{
if(edit3 ->text()=="520cxk"&&edit4 ->text()=="1314520")
{
qDebug()<< "你好,真爱粉";
this->close();
}
else
{
speecher->say("死黑粉,唉哟,你干嘛!");
qDebug()<< "密码错误:小黑子,露出鸡脚了吧";
this->edit3->clear();
this->edit4->clear();
}
}
void MyWidget::line()
{
QString str=edit3->text();
if(str.size()<6)
{
this->bth2->setStyleSheet("background-color:red");
}else if(str.size()==6)
{
this->bth2->setStyleSheet("background-color:green");
}else
{
this->bth2->setStyleSheet("background-color:yellow");
}
}
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
speecher =new QTextToSpeech;
//============窗口相关设置==========//
this->resize(427,330);
this->setFixedSize(427,330);
//设置图标
this->setWindowIcon(QIcon("C:\\Users\\Admin\\Desktop\\pictrue\\dahz.jpg"));
//设置窗口标题
this->setWindowTitle("唉哟,你干嘛!");
//去掉头部
this->setWindowFlag(Qt::FramelessWindowHint);
//=========标签相关设置=============//
QLabel *lab01=new QLabel(this);
//设置大小
lab01->resize(427,330);
//设置动图
QMovie *mv= new QMovie("C:\\Users\\Admin\\Desktop\\pictrue\\aix.gif");
//将动图放入标签中
lab01->setMovie(mv);
//让动图动起来
mv->start();
//自动适应
lab01->setScaledContents(true);
//创建一个标签
QLabel *lab1=new QLabel("密码:",this);
lab1->move(155,195);
lab1->resize(100,50);
//创建第二个标签
QLabel *lab2=new QLabel("ikun:",this);
lab2->move(155,135);
lab2->resize(100,50);
//创建第三个标签
QLabel *lab3=new QLabel(this);
lab3->move(100,135);
lab3->resize(50,50);
lab3->setPixmap(QPixmap(":/pictrue/xhz.webp"));
lab3->setScaledContents(true);
//创建第四个标签
QLabel *lab4=new QLabel(this);
lab4->move(100,195);
lab4->resize(50,50);
lab4->setPixmap(QPixmap(":/pictrue/dahz.jpg"));
lab4->setScaledContents(true);
//创建第五个标签
QLabel *lab5=new QLabel(this);
lab5->move(395,0);
lab5->resize(30,30);
lab5->setPixmap(QPixmap(":/pictrue/cancel.png"));
lab5->setScaledContents(true);
//创建第六个标签
QLabel *lab6=new QLabel(this);
lab6->move(155,20);
lab6->resize(150,80);
//设置动图
QMovie *mv2= new QMovie(":/pictrue/daf.gif");
//将动图放入标签中
lab6->setMovie(mv2);
//让动图动起来
mv2->start();
//自动适应
lab6->setScaledContents(true);
//=========行编译器相关设置=============//
//创建第一个行编译器
edit4 =new QLineEdit(this);
edit4->move(200,210);
edit4->setPlaceholderText("密码");
edit4->setEchoMode(QLineEdit::Password);
//创建第二个行编译器
edit3 =new QLineEdit(this);
edit3->move(200,150);
//设置占位
edit3->setPlaceholderText("QQ号/手机号/邮箱");
connect(this->edit3,&QLineEdit::textChanged,this,&MyWidget::line);
//=========按钮设置==============//
bth2 =new QPushButton("登录",this);
bth2->move(200,260);
bth2->resize(135,25);
//样式函数setStylesheet()
bth2->setStyleSheet("background-color:rgb(8,189,253);border-rader-radius:5px;");
connect(this->bth2,&QPushButton::clicked,this,&MyWidget::bth1);
}
MyWidget::~MyWidget()
{
}