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();
    }
}
相关推荐
逆向编程14 分钟前
QGIS地图投影(CRS坐标参照系)设置
开发语言
free-elcmacom21 分钟前
发际线警告!手撕《C陷阱与缺陷》终极 BOSS:signal 函数与 typedef 魔法
c语言·开发语言·visual studio code·visual studio
程序员阿鹏21 分钟前
简单介绍一下软引用
java·开发语言·jvm·数据结构·后端
haluhalu.44 分钟前
初识 Protobuf:微服务跨语言通信的一份契约
java·c语言·开发语言·c++·python
孙启超1 小时前
【AI开发之Rust】第 12 课:并发模型与同步原语
开发语言·后端·rust
敲代码的瓦龙2 小时前
Jetpack?DataBinding!!!
android·java·开发语言·mysql·android-studio
爱奥尼欧2 小时前
【C++】map、set 的底层是什么?红黑树五条性质、插入旋转到模拟实现
开发语言·数据结构·c++
君顾12 小时前
西安24小时自助健身房系统软件开发实战:需求分析与技术落地指南
java·开发语言·健身房