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();
    }
}
相关推荐
就叫_这个吧1 分钟前
Java普通类、抽象类、接口的应用和区别
java·开发语言
梅孔立4 分钟前
解决Nginx缓存不写入响应体问题:浏览器强制不缓存配置教程
java·开发语言·nginx·spring
代码改善世界5 分钟前
【C++进阶】红黑树模拟实现mymap和myset
开发语言·c++
zzj_26261020 分钟前
实验七 Python 文件操作与异常处理
开发语言·python
LiLiYuan.24 分钟前
【happens-before 八大规则详解】
java·开发语言
断点之下29 分钟前
从C的struct到C++的class:封装、this指针、三大特性入门
开发语言·c++
yongui4783429 分钟前
基于稀疏低秩分解的图像去噪MATLAB实现
开发语言·matlab
誰能久伴不乏30 分钟前
工业级 Modbus 上位机架构:基于滴答引擎与状态锁的高并发调度器
c++·qt·架构
geovindu32 分钟前
python: N-Barrier Pattern
开发语言·python·设计模式·屏障模式
战族狼魂41 分钟前
MetaPrompt编译器核心逻辑拆解
开发语言·人工智能·python