Qt day3

widget.cpp

#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_clicked()
{
    if(ui->lineEdit->text()=="SteamId:admin"&&ui->lineEdit_2->text()=="Passwd:1")
    {
        int res = QMessageBox::information(this,"information","Log in success",QMessageBox::Ok);
        if(QMessageBox::Ok==res)
        {
            this->close();
        }
    }
    else
    {
        int res = QMessageBox::information(this,
                                 "information",
                                 "The account and password do not match,Do you want to log in again",
                                 QMessageBox::Yes|QMessageBox::No);
        if(res==QMessageBox::Yes)
        {
            ui->lineEdit_2->clear();
            QMessageBox::information(this,"information","continue Log in",QMessageBox::Ok);
        }
    }
}

widget.h

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QMessageBox>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void on_pushButton_clicked();

private:
    Ui::Widget *ui;
};
#endif // WIDGET_H

 样式表代码

*{
	background-color:rgb(255,255,255)
}

QFrame#frame{
	border-image: url(:/Logo/AK.png);
}

#frame_2{	
	background-color: rgba(185, 184, 184, 100);
}
QLabel#label{
	border-radius:30px;

	background-color: rgba(79, 79, 79, 100);
}
#label_2{
	background:transparent;
	
	font: 75 16pt "华文行楷";
	
	color: rgba(255, 255, 255, 100);
}
#label_3{
	background:transparent;
	
	font: 75 8pt "微软雅黑";
	
	color: rgba(255, 255, 255, 100);
}
QLineEdit{
	background:transparent;

	border:none;

	border-bottom:1px solid rgba(255, 255, 255, 100);

	font: 8pt "微软雅黑";
	
	color: rgba(255, 255, 255, 100);
}

QPushButton{
	border-radius:10px;
	
	background-color: qlineargradient(spread:reflect, x1:0.469, y1:0.238636, x2:1, y2:1, stop:0 rgba(90, 123, 233, 254), stop:1 rgba(255, 255, 255, 255));
	
	font: 75 10pt "微软雅黑";

	color: rgba(255, 255, 255, 100);
}

QPushButton:hover{/*鼠标的移动*/
	border-radius:10px;
	
	background-color: qlineargradient(spread:reflect, x1:0.469, y1:0.238636, x2:1, y2:1, stop:0 rgba(48, 123, 233, 254), stop:1 rgba(255, 255, 255, 255));	
	font: 75 10pt "微软雅黑";
	color: rgba(255, 255, 255, 100);
}

QPushButton:pressed{/*鼠标点击*/
	border-radius:10px;
	
	background-color: qlineargradient(spread:reflect, x1:0.469, y1:0.238636, x2:1, y2:1, stop:0 rgba(90, 123, 233, 254), stop:1 rgba(255, 255, 255, 255));
	
	font: 75 10pt "微软雅黑";

	color: rgba(255, 255, 255, 100);

	padding-top:5px;
	padding-left:5px;
}

 成功登录

登录失败

 

  • 15
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

心若向阳,何惧悲伤

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值