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();
    }
}
相关推荐
Z文的博客1 分钟前
嵌入式LINUX QT 开发 .gitignore 文件编写指南
linux·git·qt·elasticsearch·嵌入式
初心未改HD2 分钟前
Go语言接口与nil深度解析
开发语言·golang
Achou.Wang5 分钟前
go语言并发编程
java·开发语言·golang
小王师傅666 分钟前
【Java结构化梳理】泛型-初步了解-中
java·开发语言
CQU_JIAKE7 分钟前
[q]4.25
java·开发语言·前端
涵涵(互关)8 分钟前
语法大全-only-writer
开发语言·前端·vue.js·typescript
skywalk816315 分钟前
lisp to 块编程 完全的中文编程思路:无空格编程
开发语言·lisp
liulian091615 分钟前
【Flutter for OpenHarmony第三方库】Flutter for OpenHarmony 离线模式实现:让你的应用无网也能萌萌哒~
开发语言·flutter·华为·php·学习方法·harmonyos
南宫萧幕18 分钟前
基于 DQN 与 Python-Simulink 联合仿真的 HEV 能量管理策略实战
开发语言·python·matlab·汽车·控制
掘根20 分钟前
【微服务即时通讯】客户端数据中心
qt·微服务·架构