代码
#include "widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
this->setFixedSize(1000,800);
this->setWindowOpacity(0.9);
this->setWindowTitle("鹏哥快聊");
this->setWindowIcon(QIcon("F:\\document\\Tencent Files\\1162417969\\FileRecv\\icon_h8db9qyxft\\icon_h8db9qyxft\\QQ.png"));
/*******************上半部分************************/
QLabel *lab1=new QLabel(this);
lab1->resize(1000,350);
//lab1->setWindowOpacity(1);
QMovie *move1=new QMovie("C:\\Users\\Lenovo\\Downloads\\登录.gif");
lab1->setMovie(move1);
//lab1->setPixmap(QPixmap("C:\\Users\\Lenovo\\Desktop\\背景图.png"));
lab1->setScaledContents(true);
move1->start();
QLabel *lab2=new QLabel(this);
//lab2->setWindowOpacity(0.9);
lab2->setPixmap(QPixmap("C:\\Users\\Lenovo\\Downloads\\登录1.jpg"));
lab2->setScaledContents(true);
lab2->setGeometry(QRect(0,350,1000,650));
edit1=new QLineEdit(this);
edit1->resize(300,50);
edit1->move(350,400);
edit1->setPlaceholderText("账号");
edit2=new QLineEdit(this);
edit2->resize(300,50);
edit2->move(350,500);
edit2->setPlaceholderText("密码");
edit2->setEchoMode(QLineEdit::Password);
lab3=new QLabel(this);
lab3->resize(50,50);
lab3->move(250,400);
lab3->setPixmap(QPixmap("F:\\document\\Tencent Files\\1162417969\\FileRecv\\icon_h8db9qyxft\\icon_h8db9qyxft\\denglu.png"));
lab3->setScaledContents(true);
lab4=new QLabel(this);
lab4->resize(50,50);
lab4->move(250,500);
lab4->setPixmap(QPixmap("F:\\document\\Tencent Files\\1162417969\\FileRecv\\icon_h8db9qyxft\\icon_h8db9qyxft\\denglumima.png"));
lab4->setScaledContents(true);
btn1=new QPushButton("登录",this);
btn1->setIcon(QIcon("F:\\document\\Tencent Files\\1162417969\\FileRecv\\icon_h8db9qyxft\\icon_h8db9qyxft\\denglu_1.png"));
btn1->resize(150,90);
btn1->move(300,600);
// connect(btn1,&QPushButton::clicked,this,&Widget::btn1_slot);
connect(btn1,SIGNAL(clicked()),this,SLOT(btn1_slot()));
btn2=new QPushButton("取消",this);
btn2->setIcon(QIcon("F:\\document\\Tencent Files\\1162417969\\FileRecv\\icon_h8db9qyxft\\icon_h8db9qyxft\\quxiao.png"));
btn2->resize(150,90);
btn2->move(500,600);
connect(btn2,SIGNAL(clicked()),this,SLOT(my_slot()));
}
void Widget::my_slot()
{
this->close();
}
void Widget::btn1_slot()
{
if(this->edit2->text()=="123456" && this->edit1->text()=="admin")
{
qDebug()<<"登陆成功";
emit my_signal();
this->close();
}
else
{
qDebug()<<"登录失败";
this->edit2->setText("");
}
}
//void Widget::
Widget::~Widget()
{
}
#include "second.h"
#include "ui_second.h"
second::second(QWidget *parent) :
QWidget(parent),
ui(new Ui::second)
{
ui->setupUi(this);
}
second::~second()
{
delete ui;
}
void second::jump_slot()
{
this->show();
}
思维导图