Qt day2

思维导图:

作业:

复制代码
#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
   QMovie *mov=new QMovie("E:\\1.QQ\\1774024653\\FileRecv\\pictrue\\qq.gif");
   ui->logol->setMovie(mov);
   mov->start();
   ui->logol->setScaledContents(1);

   ui->username_button->setPixmap(QPixmap(":/pictrue/login.png"));
   ui->username_button->setScaledContents(1);
   ui->passward_button->setPixmap(QPixmap(":/pictrue/passwd.jpg"));
   ui->passward_button->setScaledContents(1);

   ui->username_edit->setPlaceholderText("请输入用户名/注册");
   ui->username_edit->setEchoMode(QLineEdit::Normal);
   ui->passwardedit->setPlaceholderText("密码");
   ui->passwardedit->setEchoMode(QLineEdit::Password);

   connect(ui->loginbutton,SIGNAL(clicked()),this,SLOT(my_slot()));


}
void Widget::my_slot(){
    QString username=ui->username_edit->text();
    QString password=ui->passwardedit->text();
    if(username=="admin"&& password=="123456"){
//        qDebug()<<"登录成功";
       QMessageBox::information(this,"登录状态","登录成功");
        this->close();
    }else {
//            qDebug()<<"密码错误";
            QMessageBox::warning(this,"status","登录失败");
            ui->passwardedit->clear();


        }

    }


Widget::~Widget()
{
    delete ui;
}


void Widget::on_cancel_button_clicked()
{
    this->close();
}
相关推荐
csbysj20201 分钟前
Python 循环嵌套
开发语言
深蓝海拓3 分钟前
PySide6从0开始学习的笔记(二十六) 重写Qt窗口对象的事件(QEvent)处理方法
笔记·python·qt·学习·pyqt
测试_AI_一辰4 分钟前
Agent & RAG 测试工程05:把 RAG 的检索过程跑清楚:chunk 是什么、怎么来的、怎么被命中的
开发语言·人工智能·功能测试·自动化·ai编程
Coding茶水间6 分钟前
基于深度学习的输电电力设备检测系统演示与介绍(YOLOv12/v11/v8/v5模型+Pyqt5界面+训练代码+数据集)
开发语言·人工智能·深度学习·yolo·目标检测·机器学习
清风~徐~来10 分钟前
【视频点播系统】BRpc 介绍及使用
开发语言
啟明起鸣12 分钟前
【C++ 性能提升技巧】C++ 的引用、值类型、构造函数、移动语义与 noexcept 特性,可扩容的容器
开发语言·c++
故以往之不谏14 分钟前
函数--值传递
开发语言·数据结构·c++·算法·学习方法
卢锡荣27 分钟前
Type-c OTG数据与充电如何进行交互使用应用讲解
c语言·开发语言·计算机外设·电脑·音视频
A懿轩A41 分钟前
【Java 基础编程】Java 变量与八大基本数据类型详解:从声明到类型转换,零基础也能看懂
java·开发语言·python