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();
    }
}
相关推荐
低频电磁之道2 分钟前
C++中类的this指针
开发语言·c++
深蓝海拓8 分钟前
PySide6从0开始学习的笔记(二十) qdarkstyle的深入应用
笔记·python·qt·学习·pyqt
世转神风-22 分钟前
qt-通信协议基础-double转成QbyteArray-小端系统
开发语言·qt
web3.088899933 分钟前
小红书笔记评论API接口详情展示
开发语言·笔记·python
手抄二进制34 分钟前
使用Anaconda创建python环境并链接到Jupyter
开发语言·python·jupyter
古城小栈1 小时前
go-zero 从入门到实战 全指南(包的)
开发语言·后端·golang
lsx2024061 小时前
Python 3 函数
开发语言
-To be number.wan1 小时前
C++ 进阶技巧:如何让 cout << 自定义对象 正常输出?
开发语言·c++
2501_944446001 小时前
Flutter&OpenHarmony状态管理方案详解
开发语言·javascript·flutter
一路往蓝-Anbo1 小时前
C语言从句柄到对象 (三) —— 抛弃 Malloc:静态对象池与索引句柄的终极形态
c语言·开发语言·数据结构·stm32·单片机·算法