qt图形化界面开发DAY4

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);
    this->setWindowIcon(QIcon(":/Logo/qq.jpg"));
    ui->lineEdit_username->setText("admin");
    ui->lineEdit_userpasswd->setText("123456");
}

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

void Widget::on_pushButton_close_clicked()
{
    this->close();
}

void Widget::on_pushButton_login_clicked()
{
    QString name=ui->lineEdit_username->text();
    QString passwd=ui->lineEdit_userpasswd->text();
    if(name == "admin" && passwd == "123456"){
        int ret = QMessageBox::information(this,
                                           "登录成功!",
                                           "将跳转下一个页面..",
                                           QMessageBox::Ok |QMessageBox::No);
        if(ret == QMessageBox::Ok){
            this->close();
            emit this->jump_alarm();
        }

    }else {
        int ret = QMessageBox::critical(this,
                                        "登录失败",
                                        "账号密码不匹配,是否重新登录",
                                        QMessageBox::Yes |QMessageBox::No);
        if(ret == QMessageBox::Yes){
            ui->lineEdit_username->clear();
            ui->lineEdit_userpasswd->clear();
        }else if(ret == QMessageBox::No){
            int ret = QMessageBox::question(this,
                                            "退出登录",
                                            "您是否确定要退出登录",
                                            QMessageBox::Yes |QMessageBox::No);
            if(ret == QMessageBox::Yes){
                this->close();
            }else if(ret == QMessageBox::No){
            }
        }
    }
}
相关推荐
YUJIANYUE17 分钟前
PHP纹路验证码
开发语言·php
仟濹29 分钟前
【Java基础】多态 | 打卡day2
java·开发语言
孞㐑¥29 分钟前
算法——BFS
开发语言·c++·经验分享·笔记·算法
Re.不晚30 分钟前
JAVA进阶之路——无奖问答挑战2
java·开发语言
八零后琐话33 分钟前
干货:程序员必备性能分析工具——Arthas火焰图
开发语言·python
3GPP仿真实验室35 分钟前
【MATLAB源码】CORDIC-QR :基于Cordic硬件级矩阵QR分解
开发语言·matlab·矩阵
知南x1 小时前
【Ascend C系列课程(高级)】(1) 算子调试+调优
c语言·开发语言
忆~遂愿1 小时前
GE 引擎与算子版本控制:确保前向兼容性与图重写策略的稳定性
大数据·开发语言·docker
Ro Jace1 小时前
计算机专业基础教材
java·开发语言
代码游侠2 小时前
学习笔记——设备树基础
linux·运维·开发语言·单片机·算法