//主函数
#include "widget.h"
#include "from.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
From f;
QObject::connect(&w,&Widget::my_jump,&f,&From::jump_slot);
return a.exec();
}
//第一个页面
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
}
Widget::~Widget()
{
delete ui;
}
void Widget::on_pushButton_2_clicked()
{
close();
}
void Widget::on_pushButton_clicked()
{
QString get = ui->lineEdit->text();//获取UsernameEdit文本内容
QString getpa = ui->lineEdit_2->text();//获取PassEdit文本内容
if(get == "admin" && getpa == "123456")
{
close();//关闭窗口
emit my_jump();
}else
{
QMessageBox::warning(this, "登录", "登录失败");//弹出警告框
ui->lineEdit->clear();//清空UsernameEdit文本
ui->lineEdit_2->clear();//清空PassEdit文本内容
}
}
//第二个页面
#include "from.h"
#include "ui_from.h"
From::From(QWidget *parent) :
QWidget(parent),
ui(new Ui::From)
{
ui->setupUi(this);
}
From::~From()
{
delete ui;
}
void From::jump_slot()
{
this->show();
}
//样式表
*{
background-color: rgb(255, 255, 255);
}
QFrame#frame{
border-radius:30px;
border-image: url(:/shanChuan.jpg)
}
QLabel#label{
border-radius:30px;
background-color: rgba(70, 70, 70, 100);
}
#label_2{
background:transparent;/*完全透明*/
font: 20pt "等线";
color: rgba(255, 255, 255, 120);
}
QLineEdit{
background:transparent;/*完全透明*/
border:none;
border-bottom:1px solid
rgba(255, 255, 255, 120);
color: rgba(255, 255, 255, 120);
font: 12pt "等线";
}
QPushButton#pushButton{
font: 14pt "等线";
color: rgba(255, 255, 255, 100);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(180, 71, 96, 255), stop:1 rgba(255, 255, 255, 255));
border-radius:5px;
}
QPushButton:hover{
font: 14pt "等线";
color: rgba(255, 255, 255, 100);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(150, 71, 96, 255), stop:1 rgba(255, 255, 255, 255));
border-radius:5px;
}
QPushButton:pressed{
font: 14pt "等线";
color: rgba(255, 255, 255, 100);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(210, 71, 96, 255), stop:1 rgba(255, 255, 255, 255));
border-radius:5px;
padding-top:5px;
padding-left:5px;
}
#pushButton_2{
background:transparent;
font: 12pt "等线";
}
6月17日作业
于 2024-06-18 08:58:25 首次发布