【无标题】

#include "mywidget.h"
#include "ui_mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::MyWidget)
{
    ui->setupUi(this);

    //接收动图
    QMovie *mv = new QMovie(":/pictrue/luori.gif");
    ui->loglab->setMovie(mv);
    //让动图动起来
    mv->start();
    //设置用户图标
    ui->usenamelab->setPixmap(QPixmap(":/pictrue/name.jpg"));
    ui->usenamelab->setScaledContents(true);
    //设置密码图标
    ui->passwdlab->setPixmap(QPixmap(":/pictrue/passwd.jpg"));
    ui->passwdlab->setScaledContents(true);
    //设置额外图标
    ui->guohuilab->setPixmap(QPixmap(":/pictrue/guohui.png"));
    ui->guohuilab->setScaledContents(true);
    //设置登录按钮
    ui->logButton->setStyleSheet("background-color:rgb(224,154,68);"
                                 "border-radius:10px");

    //隐藏边框
    this->setWindowFlag(Qt::FramelessWindowHint);
    //设置行编辑器 占位  透明度
    ui->usernameEdit->setPlaceholderText("QQ号/手机/邮箱");
    ui->usernameEdit->setStyleSheet("background-color:rgba(224,255,255,0.2);border:none");
    ui->passwdEdit->setPlaceholderText("密码");
    ui->passwdEdit->setStyleSheet("background-color:rgba(255,255,255,0.2);border:none");
    //设置窗口图标和名字
    this->setWindowTitle("心中有党,成绩理想");
    this->setWindowIcon(QIcon(":/pictrue/luobo.jpg"));
    //设置关闭图标
    ui->closeButton->setStyleSheet("background-color:rgba(224,154,68,0.1)");
    //基于Qt4版本的叉号按钮的手动链接
    connect(ui->closeButton,SIGNAL(clicked()),this,SLOT(closeButton_slot()));
    //基于Qt5版本的登录按钮的手动连接
    connect(ui->logButton,&QPushButton::clicked,this,&MyWidget::logButton_slot);


}

MyWidget::~MyWidget()
{
    delete ui;
}




//槽函数实现
void MyWidget::closeButton_slot()
{
    this->close();
}

void MyWidget::logButton_slot()
{

    if(ui->usernameEdit->text()== "admin" && ui->passwdEdit->text()== "123456" )
    {
        qDebug() << "登录成功";
        this->close();
        emit jump_signal();
    }
    else if(ui->usernameEdit->text()!="admin" || ui->passwdEdit->text()!= "123456")
    {
        qDebug("%s","登录失败");
        ui->usernameEdit->clear();
        ui->passwdEdit->clear();
    }

}

登录界面

 

*{
	background-color: rgb(255, 255, 255);
}
QFrame#frame{
	border-radius:30px;
	border-image: url(:/pictrue/feige.jpg);
}
#frame_2{
	border-radius:30px;
	background-color: rgba(95, 95, 95, 125);
}
QLabel#label{
	border-radius:30px;
	background-color: rgba(67, 67, 67, 160);
}
#label_2{
	background:transparent;
	
	color: rgba(255, 255, 255, 160);
	font: 25pt "等线";
}
QLineEdit{
	background:transparent;
	border:none;
	font: 14pt "等线";
	color: rgba(255, 255, 255, 160);
	border-bottom:1px solid rgba(255, 255, 255, 160);
}
QPushButton{
	font: 14pt "等线";
	color: rgba(255, 255, 255, 160);
    border-radius:10px;
	
	background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));
}
QPushButton:hover{
	font: 14pt "等线";
	color: rgba(255, 255, 255, 160);
    border-radius:10px;
	
	background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(50, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));
}
QPushButton:pressed{
	font: 14pt "等线";
	color: rgba(255, 255, 255, 160);
    border-radius:10px;
	padding-top:5px;
	padding-left:5px;
	
	background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值