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 小时前
BOM模型
开发语言·前端·javascript·bom
二哈喇子!1 小时前
空指针异常
开发语言
咚为2 小时前
Rust Print 终极指南:从底层原理到全场景实战
开发语言·后端·rust
%xiao Q2 小时前
GESP C++五级-202406
android·开发语言·c++
Psycho_MrZhang2 小时前
Neo4j Python SDK手册
开发语言·python·neo4j
Traced back2 小时前
# C# + SQL Server 实现自动清理功能的完整方案:按数量与按日期双模式
开发语言·c#
sin22012 小时前
MyBatis的执行流程
java·开发语言·mybatis
web3.08889992 小时前
1688图片搜索API,相似商品精准推荐
开发语言·python
二哈喇子!2 小时前
JAVA环境变量配置步骤及测试(JDK的下载 & 安装 & 环境配置教程)
java·开发语言
少云清2 小时前
【性能测试】15_JMeter _JMeter插件安装使用
开发语言·python·jmeter