当前位置: 首页 > news >正文

Qt 练习做一个登录界面

练习做一个登录界面

效果

UI图

UI代码

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>Dialog</class><widget class="QDialog" name="Dialog"><property name="geometry"><rect><x>0</x><y>0</y><width>440</width><height>765</height></rect></property><property name="windowTitle"><string>Dialog</string></property><layout class="QVBoxLayout" name="verticalLayout_2"><property name="leftMargin"><number>10</number></property><property name="topMargin"><number>10</number></property><property name="rightMargin"><number>10</number></property><property name="bottomMargin"><number>10</number></property><item><widget class="QWidget" name="widget" native="true"><layout class="QHBoxLayout" name="horizontalLayout"><property name="leftMargin"><number>10</number></property><property name="topMargin"><number>10</number></property><property name="rightMargin"><number>10</number></property><property name="bottomMargin"><number>10</number></property><item><widget class="QPushButton" name="btnSet"><property name="minimumSize"><size><width>32</width><height>32</height></size></property><property name="maximumSize"><size><width>32</width><height>32</height></size></property><property name="text"><string>PushButton</string></property></widget></item><item><widget class="QLabel" name="label_Title"><property name="text"><string>视频会议</string></property><property name="alignment"><set>Qt::AlignmentFlag::AlignCenter</set></property></widget></item><item><widget class="QPushButton" name="btnMin"><property name="minimumSize"><size><width>32</width><height>32</height></size></property><property name="maximumSize"><size><width>32</width><height>32</height></size></property><property name="text"><string>PushButton</string></property></widget></item><item><widget class="QPushButton" name="btnClose"><property name="minimumSize"><size><width>32</width><height>32</height></size></property><property name="maximumSize"><size><width>32</width><height>32</height></size></property><property name="text"><string>PushButton</string></property></widget></item></layout></widget></item><item><spacer name="verticalSpacer"><property name="orientation"><enum>Qt::Orientation::Vertical</enum></property><property name="sizeType"><enum>QSizePolicy::Policy::Fixed</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>40</height></size></property></spacer></item><item><layout class="QHBoxLayout" name="horizontalLayout_4"><item><spacer name="horizontalSpacer"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item><item><widget class="QLabel" name="label_logo"><property name="minimumSize"><size><width>400</width><height>336</height></size></property><property name="maximumSize"><size><width>400</width><height>336</height></size></property><property name="text"><string/></property><property name="alignment"><set>Qt::AlignmentFlag::AlignCenter</set></property></widget></item><item><spacer name="horizontalSpacer_2"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item></layout></item><item><spacer name="verticalSpacer_2"><property name="orientation"><enum>Qt::Orientation::Vertical</enum></property><property name="sizeType"><enum>QSizePolicy::Policy::Fixed</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>35</height></size></property></spacer></item><item><layout class="QHBoxLayout" name="horizontalLayout_5"><item><spacer name="horizontalSpacer_3"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item><item><layout class="QVBoxLayout" name="verticalLayout"><item><widget class="QPushButton" name="btnWeichatLogin"><property name="minimumSize"><size><width>400</width><height>50</height></size></property><property name="maximumSize"><size><width>400</width><height>50</height></size></property><property name="styleSheet"><string notr="true">QPushButton:hover
{/*边框色*/border-color:blue;
}</string></property><property name="text"><string>微信登录</string></property></widget></item><item><spacer name="verticalSpacer_3"><property name="orientation"><enum>Qt::Orientation::Vertical</enum></property><property name="sizeType"><enum>QSizePolicy::Policy::Fixed</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>15</height></size></property></spacer></item><item><widget class="QPushButton" name="btnJoin"><property name="minimumSize"><size><width>400</width><height>50</height></size></property><property name="maximumSize"><size><width>400</width><height>50</height></size></property><property name="styleSheet"><string notr="true"/></property><property name="text"><string>加入会议</string></property></widget></item></layout></item><item><spacer name="horizontalSpacer_4"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item></layout></item><item><layout class="QHBoxLayout" name="horizontalLayout_2"><item><widget class="Line" name="line"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property></widget></item><item><widget class="QLabel" name="label_3"><property name="text"><string>其他登录方式</string></property><property name="alignment"><set>Qt::AlignmentFlag::AlignCenter</set></property></widget></item><item><widget class="Line" name="line_2"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property></widget></item></layout></item><item><layout class="QHBoxLayout" name="horizontalLayout_3"><item><widget class="QToolButton" name="toolBtnPhone"><property name="minimumSize"><size><width>60</width><height>80</height></size></property><property name="maximumSize"><size><width>60</width><height>80</height></size></property><property name="text"><string>...</string></property></widget></item><item><widget class="QToolButton" name="toolBtnEnpriseWeichat"><property name="minimumSize"><size><width>60</width><height>80</height></size></property><property name="maximumSize"><size><width>60</width><height>80</height></size></property><property name="text"><string>...</string></property></widget></item><item><widget class="QToolButton" name="toolBtnSSO"><property name="minimumSize"><size><width>60</width><height>80</height></size></property><property name="maximumSize"><size><width>60</width><height>80</height></size></property><property name="text"><string>...</string></property></widget></item></layout></item></layout></widget><resources/><connections/>
</ui>

项目结构

样式代码

dialog.cpp

#include "dialog.h"
#include "ui_dialog.h"Dialog::Dialog(QWidget *parent): QDialog(parent), ui(new Ui::Dialog)
{ui->setupUi(this);this->setStyleSheet("background-color:white");//去除边框 : Qt::FramelessWindowHint//点任务拦图标时 显示和隐藏 窗口 Qt::WindowMinMaxButtonsHintthis->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint);ui->btnSet->setText("");//写样式表ui->btnSet->setStyleSheet("QPushButton{background-image:url(://resources/set.png);border:none} QPushButton::hover{background-color:rgb(99,99,99)}");ui->btnMin->setText("");//写样式表ui->btnMin->setStyleSheet("QPushButton{background-image:url(://resources/min.png);border:none} QPushButton::hover{background-color:rgb(99,99,99)}");ui->btnClose->setText("");//写样式表ui->btnClose->setStyleSheet("QPushButton{background-image:url(://resources/close.png);border:none} QPushButton::hover{background-color:rgb(99,99,99)}");ui->label_logo->setText("");//显示图片QPixmap *pic = new QPixmap("://resources/logo.jpg");//设置图片缩放pic->scaled(ui->label_logo->size(),Qt::KeepAspectRatio);ui->label_logo->setScaledContents(true);ui->label_logo->setPixmap(*pic);ui->btnWeichatLogin->setText("");//写样式表ui->btnWeichatLogin->setStyleSheet("QPushButton{background-image:url(://resources/weichatlogin.png);border:none} QPushButton::hover{border-color:blue}");ui->toolBtnPhone->setText("手机号");ui->toolBtnPhone->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);ui->toolBtnPhone->setIconSize(QSize(60,60));ui->toolBtnPhone->setIcon(QIcon(":/resources/phonelogin.png"));ui->toolBtnPhone->setStyleSheet("border:none");ui->toolBtnEnpriseWeichat->setText("企业微信");ui->toolBtnEnpriseWeichat->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);ui->toolBtnEnpriseWeichat->setIconSize(QSize(60,60));ui->toolBtnEnpriseWeichat->setIcon(QIcon(":/resources/enpriseweichat.png"));ui->toolBtnEnpriseWeichat->setStyleSheet("border:none");ui->toolBtnSSO->setText("SSO");ui->toolBtnSSO->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);ui->toolBtnSSO->setIconSize(QSize(60,60));ui->toolBtnSSO->setIcon(QIcon(":/resources/sso.png"));ui->toolBtnSSO->setStyleSheet("border:none");//事件//关闭事件connect(ui->btnClose,&QPushButton::clicked,[=]{close();});connect(ui->btnMin,&QPushButton::clicked,[=]{showMinimized();//最小化//showMaximized();//最大化//if(this->isMaximized())});//判断是否最大化if(isMaximized()){}//判断是否最小化if(isMinimized()){showMaximized();//最大化}
}Dialog::~Dialog()
{delete ui;
}

今天时间有限,先写到这里,后面在细化怎么一步步做出来的

相关文章:

Qt 练习做一个登录界面

练习做一个登录界面 效果 UI图 UI代码 <?xml version"1.0" encoding"UTF-8"?> <ui version"4.0"><class>Dialog</class><widget class"QDialog" name"Dialog"><property name"ge…...

计算机视觉实验一:图像基础处理

1. 图像的直方图均衡 1.1 实验目的与要求 (1)理解直方图均衡的原理与作用; (2)掌握统计图像直方图的方法; (3)掌握图像直方图均衡的方法。 1.2 实验原理及知识点 直方图均衡化是通过灰度变换将一幅图象转换为另一幅均衡直方图&#xff0c;即在每个灰度级上都具有相同的象素…...

【WebApi】C# webapi 后端接收部分属性

在C#的Web API后端接收部分属性,可以使用[FromBody]特性配合JsonPatchDocument或者Delta来实现。这里提供一个使用JsonPatchDocument的示例。 首先,定义一个模型类:public class User public class User {public int Id {get; set; }...

Java 使用 Redis

Java 使用 Redis 1. 引言 Redis是一个开源的、基于内存的数据结构存储系统,可以用作数据库、缓存和消息中间件。它支持多种类型的数据结构,如字符串、哈希、列表、集合、有序集合等。由于Redis基于内存,其读写速度非常快,因此被广泛应用于需要高速缓存和实时通讯的场景。…...

【ONE·Linux || 高级IO(二)】

总言 主要内容&#xff1a;多路转接&#xff1a;epoll学习。       文章目录 总言5、多路转接&#xff1a;epoll5.1、相关概念与接口5.1.1、基本函数认识5.1.1.1、epoll_create5.1.1.2、epoll_ctl5.1.1.3、epoll_wait 5.1.2、epoll的工作原理5.1.2.1、准备工作&#xff08;…...

将 IBM WatsonX 数据与 Milvus 结合使用,构建用于知识检索的智能 Slack 机器人

在当今快节奏的工作环境中&#xff0c;快速轻松地访问信息对于保持生产力和效率至关重要。无论是在 Runbook 中查找特定说明&#xff0c;还是访问关键知识转移 &#xff08;KT&#xff09; 文档&#xff0c;快速检索相关信息的能力都可以产生重大影响。 本教程将指导您构建一个…...

2024 网鼎杯 CTF --- Crypto wp

文章目录 青龙组Crypto1Crypto2 白虎组Crypto1Crypto2 朱雀组Crypto2Crypto3part1part2part3part4 青龙组 Crypto1 题目&#xff1a; from Crypto.Util.number import * from secret import flagp getPrime(512) q getPrime(512) n p * q d getPrime(299) e inverse(d,…...

深度学习基础知识-损失函数

目录 1. 均方误差&#xff08;Mean Squared Error, MSE&#xff09; 2. 平均绝对误差&#xff08;Mean Absolute Error, MAE&#xff09; 3. Huber 损失 4. 交叉熵损失&#xff08;Cross-Entropy Loss&#xff09; 5. KL 散度&#xff08;Kullback-Leibler Divergence&…...

《逆向记录》

这里写自定义目录标题 1.什么是vmp加密VMP加密的工作原理VMP加密的应用场景和优缺点实际应用案例 2.什么是ast混淆3.魔改算法总结 1.什么是vmp加密 ‌VMP加密&#xff08;Virtual Machine Protection&#xff09;‌是一种软件保护技术&#xff0c;旨在通过虚拟化和加密技术来保…...

chatgpt3.5权重参数有多少MB;llama7B权重参数有多少MB

目录 chatgpt3.5权重参数有多少MB llama7B权重参数有多少MB chatgpt3.5权重参数有多少MB 关于ChatGPT 3.5的权重参数占用的存储空间大小,虽然直接给出具体的MB数值可能较为困难(因为这取决于多种因素,如参数表示的精度、是否进行了压缩等),但可以根据其参数量来估算一个…...

ST IoT Wireless 物联网与无线技术 研讨会

一、研讨会背景与目的 ◆ 意法半导体致力于提供可靠且经济实惠的无线连接解决方案,包含Wireless NFC Security & Esim等产品。 ◆ 将智能物体连接到互联网和云&#xff0c;或者从更广泛的意义上说&#xff0c;连接到物联网&#xff08;IoT&#xff09;。 ◆ 远程监控、配…...

PHP实现雪花算法生成唯一ID

引言 雪花算法是Twitter开源的分布式ID生成算法&#xff0c;可以产生64位的ID。其中第一位是固定的正数标识&#xff0c;41位用于存储时间戳&#xff0c;剩下的为机器ID和序列号。通过时间戳、机器ID和序列号的组合&#xff0c;确保每个ID都是唯一的。 PHP代码 1、定义雪花算…...

APP的设置页面,应该怎样尽可能减少用户的输入操作呢

一、引言 在当今数字化时代&#xff0c;移动应用程序&#xff08;APP&#xff09;已经成为人们生活中不可或缺的一部分。无论是社交娱乐、工作学习还是日常生活&#xff0c;我们都离不开各种 APP 的帮助。而 APP 的设置页面作为用户调整应用参数、个性化定制功能的重要入口&am…...

Node.js:内置模块

Node.js&#xff1a;内置模块 Node.jsfs模块读取文件写入文件__dirname path模块路径拼接文件名解析 http模块创建服务 Node.js 传统的JavaScript是运行在浏览器的&#xff0c;浏览器就是其运行环境。 浏览器提供了JavaScript的API&#xff0c;以及解析JavaScript的解析引擎&a…...

3. keil + vscode 进行stm32协同开发

1. 为什么使用vscode 主要还是界面友好&#xff0c;使用习惯问题&#xff0c;vscode 从前端&#xff0c;js, c/c, qt, 仓颉&#xff0c;rust都有很好插件的支持&#xff0c;并且有romote&#xff0c; wsl 等很多插件可以提高效率&#xff0c; 唯一的问题就是要使用插件进行环境…...

React 组件生命周期与 Hooks 简明指南

文章目录 一、类组件的生命周期方法1. 挂载阶段2. 更新阶段3. 卸载阶段 二、函数组件中的 Hooks1. useState2. useEffect3. useContext4. useReducer 结论 好的&#xff0c;我们来详细讲解一下 React 类组件的生命周期方法和函数组件中的钩子&#xff08;hooks&#xff09;。 …...

【springcloud】gateway网关的作用

目录 1. 说明2. 路由转发3. 负载均衡4. 安全认证与授权5. 熔断与降级6. 请求限流7. 监控与日志8. 过滤器功能 1. 说明 1.在Spring Cloud中&#xff0c;Gateway网关扮演着至关重要的角色。2.基于Spring Framework 5、Spring Boot和Project Reactor构建的API网关&#xff0c;专为…...

「C/C++」C++11 之<thread>多线程编程

✨博客主页何曾参静谧的博客📌文章专栏「C/C++」C/C++程序设计📚全部专栏「VS」Visual Studio「C/C++」C/C++程序设计「UG/NX」BlockUI集合「Win」Windows程序设计「DSA」数据结构与算法「UG/NX」NX二次开发「QT」QT5程序设计「File」数据文件格式「PK」Parasolid函数说明目…...

HTML前端页面设计静态网站-仿百度

浅浅分享一下前端作业&#xff0c;大佬轻喷~ <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><title>百度&#xff08;伪&#xff09;</title><style>body {margin: 0;padding: 0;}.top-bar {dis…...

百度SEO是否还有用?福州百度SEO专家林汉文为你深度解析

大家好&#xff0c;我是林汉文&#xff0c;一名专注于百度SEO优化的专家&#xff0c;最近有很多人问我&#xff1a;百度SEO还有用吗&#xff1f;在如今快速变化的数字营销环境中&#xff0c;这确实是一个值得探讨的问题。今天&#xff0c;我就来为大家详细分析百度SEO的现状&am…...

调用支付宝接口响应40004 SYSTEM_ERROR问题排查

在对接支付宝API的时候&#xff0c;遇到了一些问题&#xff0c;记录一下排查过程。 Body:{"datadigital_fincloud_generalsaas_face_certify_initialize_response":{"msg":"Business Failed","code":"40004","sub_msg…...

FastAPI 教程:从入门到实践

FastAPI 是一个现代、快速&#xff08;高性能&#xff09;的 Web 框架&#xff0c;用于构建 API&#xff0c;支持 Python 3.6。它基于标准 Python 类型提示&#xff0c;易于学习且功能强大。以下是一个完整的 FastAPI 入门教程&#xff0c;涵盖从环境搭建到创建并运行一个简单的…...

【磁盘】每天掌握一个Linux命令 - iostat

目录 【磁盘】每天掌握一个Linux命令 - iostat工具概述安装方式核心功能基础用法进阶操作实战案例面试题场景生产场景 注意事项 【磁盘】每天掌握一个Linux命令 - iostat 工具概述 iostat&#xff08;I/O Statistics&#xff09;是Linux系统下用于监视系统输入输出设备和CPU使…...

第 86 场周赛:矩阵中的幻方、钥匙和房间、将数组拆分成斐波那契序列、猜猜这个单词

Q1、[中等] 矩阵中的幻方 1、题目描述 3 x 3 的幻方是一个填充有 从 1 到 9 的不同数字的 3 x 3 矩阵&#xff0c;其中每行&#xff0c;每列以及两条对角线上的各数之和都相等。 给定一个由整数组成的row x col 的 grid&#xff0c;其中有多少个 3 3 的 “幻方” 子矩阵&am…...

推荐 github 项目:GeminiImageApp(图片生成方向,可以做一定的素材)

推荐 github 项目:GeminiImageApp(图片生成方向&#xff0c;可以做一定的素材) 这个项目能干嘛? 使用 gemini 2.0 的 api 和 google 其他的 api 来做衍生处理 简化和优化了文生图和图生图的行为(我的最主要) 并且有一些目标检测和切割(我用不到) 视频和 imagefx 因为没 a…...

LCTF液晶可调谐滤波器在多光谱相机捕捉无人机目标检测中的作用

中达瑞和自2005年成立以来&#xff0c;一直在光谱成像领域深度钻研和发展&#xff0c;始终致力于研发高性能、高可靠性的光谱成像相机&#xff0c;为科研院校提供更优的产品和服务。在《低空背景下无人机目标的光谱特征研究及目标检测应用》这篇论文中提到中达瑞和 LCTF 作为多…...

上位机开发过程中的设计模式体会(1):工厂方法模式、单例模式和生成器模式

简介 在我的 QT/C 开发工作中&#xff0c;合理运用设计模式极大地提高了代码的可维护性和可扩展性。本文将分享我在实际项目中应用的三种创造型模式&#xff1a;工厂方法模式、单例模式和生成器模式。 1. 工厂模式 (Factory Pattern) 应用场景 在我的 QT 项目中曾经有一个需…...

如何通过git命令查看项目连接的仓库地址?

要通过 Git 命令查看项目连接的仓库地址&#xff0c;您可以使用以下几种方法&#xff1a; 1. 查看所有远程仓库地址 使用 git remote -v 命令&#xff0c;它会显示项目中配置的所有远程仓库及其对应的 URL&#xff1a; git remote -v输出示例&#xff1a; origin https://…...

在Zenodo下载文件 用到googlecolab googledrive

方法&#xff1a;Figshare/Zenodo上的数据/文件下载不下来&#xff1f;尝试利用Google Colab &#xff1a;https://zhuanlan.zhihu.com/p/1898503078782674027 参考&#xff1a; 通过Colab&谷歌云下载Figshare数据&#xff0c;超级实用&#xff01;&#xff01;&#xff0…...

【系统架构设计师-2025上半年真题】综合知识-参考答案及部分详解(回忆版)

更多内容请见: 备考系统架构设计师-专栏介绍和目录 文章目录 【第1题】【第2题】【第3题】【第4题】【第5题】【第6题】【第7题】【第8题】【第9题】【第10题】【第11题】【第12题】【第13题】【第14题】【第15题】【第16题】【第17题】【第18题】【第19题】【第20~21题】【第…...