码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • C++DAY47


    头文件

    1. #ifndef WIDGET_H
    2. #define WIDGET_H
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. QT_BEGIN_NAMESPACE
    9. namespace Ui { class Widget; }
    10. QT_END_NAMESPACE
    11. class Widget : public QWidget
    12. {
    13. Q_OBJECT
    14. public:
    15. Widget(QWidget *parent = nullptr);
    16. ~Widget();
    17. signals:
    18. void my_signal();
    19. public slots:
    20. void my_slot();
    21. void my_on();
    22. private:
    23. Ui::Widget *ui;
    24. };
    25. #endif // WIDGET_H

    源文件

    1. #include "widget.h"
    2. #include "ui_widget.h"
    3. Widget::Widget(QWidget *parent)
    4. : QWidget(parent)
    5. , ui(new Ui::Widget)
    6. {
    7. ui->setupUi(this);
    8. this->setWindowTitle("300英雄");
    9. this->setWindowIcon(QIcon(":/pic/d.gif"));
    10. this->setWindowFlag(Qt::FramelessWindowHint);
    11. ui->labe1->setPixmap(QPixmap(":/pic/5.jpg"));
    12. ui->labe1->setScaledContents(true);
    13. ui->labe2->setPixmap(QPixmap(":/pic/6.jpg"));
    14. ui->labe2->setScaledContents(true);
    15. ui->labe3->setPixmap(QPixmap(":/pic/3.gif"));
    16. ui->labe3->setScaledContents(true);
    17. ui->username->setPlaceholderText("账号");
    18. ui->password->setPlaceholderText("密码");
    19. ui->password->setEchoMode(QLineEdit::Password);
    20. this->connect(ui->Btn2,SIGNAL(clicked()),this,SLOT(my_slot()));
    21. connect(ui->Btn1,&QPushButton::clicked,this,&Widget::my_on);
    22. }
    23. Widget::~Widget()
    24. {
    25. delete ui;
    26. }
    27. void Widget::my_slot()
    28. {
    29. this->close();
    30. }
    31. void Widget::my_on()
    32. {
    33. if(ui->username->text() == "admin")
    34. {
    35. if(ui->password->text() == "123456")
    36. {
    37. qDebug() << "登录成功";
    38. this->close();
    39. }
    40. else
    41. {
    42. qDebug() << "登录失败";
    43. ui->password->clear();
    44. }
    45. }
    46. else
    47. {
    48. qDebug() << "登录失败";
    49. ui->username->clear();
    50. ui->password->clear();
    51. }
    52. }

     

     

     

  • 相关阅读:
    功能基础篇3——Python中的输入输出、文件读写、序列化
    微软和OpenAI正在开发AI芯片, 并计划下个月发布
    linux c base64编码解码
    低代码:降低技术能力要求,提升软件开发效率
    共建“医疗合规科技实验室”,美创科技实力护航医疗数据安全
    Lwip之TCP协议实现(三)
    java-net-php-python-900jspm跳蚤市场网站管理系统开题ppt计算机毕业设计程序
    ssm毕设项目学生信息管理系统63yq0(java+VUE+Mybatis+Maven+Mysql+sprnig)
    linux命令别名
    例解什么是Python装饰器
  • 原文地址:https://blog.csdn.net/weixin_69186714/article/details/133914401
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号