6月17日作业

//主函数
#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 "等线";
	
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值