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);
}

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


void Widget::on_pushButton_clicked()
{
    if(ui->lineEdit->text() == "admin" && ui->lineEdit_2->text() == "123")
    {
        QMessageBox msg(
                    QMessageBox::Information,
                    "提示",
                    "登录成功",
                    QMessageBox::Yes,
                    this);

        msg.exec();
        this->close();
        emit my_jump();
    }
    else
    {
        int ret = QMessageBox::critical(
                    this,
                    "登录失败",
                    "账号密码不匹配",
                    QMessageBox::Yes | QMessageBox::No);

        if(ret == QMessageBox::Yes)
        {
            ui->lineEdit_2->clear();
        }
        else
        {
            this->close();
        }
    }
}

void Widget::on_pushButton_2_clicked()
{
    int ret = QMessageBox::question(
                this,
                "?",
                "退出登录?",
                QMessageBox::Yes | QMessageBox::No);

    if(ret == QMessageBox::Yes)
    {
        this->close();
    }
}
相关推荐
那小子、真烦7 分钟前
Hermes Agent Chat 方法分析
java·开发语言
爱喝水的鱼丶10 分钟前
SAP-ABAP:变量、常量、结构与内表声明(10篇博客合集) 第六篇:ABAP 7.40+新特性:声明语法的简化写法与兼容注意事项
运维·服务器·开发语言·学习·算法·sap·abap
上海合宙LuatOS11 分钟前
Air8000低功耗指南
开发语言·物联网·php·lua
happymaker062620 分钟前
SpringBoot使用Thymeleaf模板引擎,前端的基本语法
开发语言·python
01_ice22 分钟前
Java抽象类和接口
java·开发语言
代钦塔拉39 分钟前
Qt QThread最标准Worker线程用法(零崩溃、零内存泄漏)
qt
小糯米6011 小时前
C语言 自定义类型:结构体 与 联合体
c语言·开发语言·数据结构
jieyucx1 小时前
Go 语言 JSON 序列化与反序列化
开发语言·golang·json·序列化
罗超驿1 小时前
6.Java多线程详解:Thread类、线程属性与start()方法深度解析
java·开发语言·面试·java-ee
海的透彻1 小时前
jmeter预制处理器JSR223-加解密
开发语言·jmeter·sm2·jsr233