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

Qtday01(qt简介、简单窗口组件)

今日任务

仿qq登录界面,QT实现

代码:

头文件:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QLineEdit>
#include <QLabel>
#include <QPushButton>
#include <QtDebug>
#include <QIcon>
#include <QMovie>
#include <QRadioButton>class MainWindow : public QMainWindow
{Q_OBJECTpublic:MainWindow(QWidget *parent = nullptr);~MainWindow();
};
#endif // MAINWINDOW_H

功能函数,窗口类:

#include "mainwindow.h"MainWindow::MainWindow(QWidget *parent): QMainWindow(parent)
{this->resize(530,410);this->setWindowTitle("知音");this->setWindowIcon(QIcon("C:\\Users\\hasee\\Desktop\\111\\logo.jpg"));//this->setWindowFlag(Qt::FramelessWindowHint);//无边框this->setStyleSheet("background-color:#faf7ec");QLabel *label2=new QLabel(this);label2->resize(530,180);QMovie *movie = new QMovie("C:\\Users\\hasee\\Desktop\\111\\cai.gif");label2->setMovie(movie);label2->setScaledContents(true);movie->start();QLabel *label1=new QLabel(this);label1->resize(50,50);label1->setPixmap(QPixmap("C:\\Users\\hasee\\Desktop\\111\\篮球.png"));label1->setScaledContents(true);QLabel *accout=new QLabel(this);accout->resize(30,30);accout->setPixmap(QPixmap("C:\\Users\\hasee\\Desktop\\111\\account.jpg"));accout->setScaledContents(true);accout->move(150,210);QLabel *passwd=new QLabel(this);passwd->resize(30,30);passwd->setPixmap(QPixmap("C:\\Users\\hasee\\Desktop\\111\\passwd.jpg"));passwd->setScaledContents(true);passwd->move(150,250);QLabel *user=new QLabel(this);user->resize(65,65);user->move(230,142);//user->setPixmap(QPixmap("C:\\Users\\hasee\\Desktop\\111\\logo.jpg"));user->setStyleSheet("border-image:url(C:/Users/hasee/Desktop/111/user.png);border-radius:30px");user->setScaledContents(true);QLineEdit *l1=new QLineEdit(this);l1->setPlaceholderText("账号");l1->resize(200,30);l1->move(190,210);QLineEdit *l2=new QLineEdit(this);l2->setPlaceholderText("密码");l2->resize(200,30);l2->move(190,250);QRadioButton *radio1=new QRadioButton("自动登录",this);radio1->resize(85,30);radio1->move(150,290);QRadioButton *radio2=new QRadioButton("记住密码",this);radio2->resize(85,30);radio2->move(240,290);QLabel *radio3=new QLabel("找回密码",this);radio3->resize(85,30);radio3->move(340,290);QPushButton *login=new QPushButton("登录",this);login->resize(250,40);login->move(150,330);login->setStyleSheet("background-color:#409EFF;border-radius:5px");QLabel *regist=new QLabel("<a href=#>注册账号</a>",this);regist->move(15,380);regist->resize(100,20);QLabel *login2=new QLabel(this);login2->setPixmap(QPixmap("C:\\Users\\hasee\\Desktop\\111\\2.png"));login2->move(480,360);login2->resize(40,40);}MainWindow::~MainWindow()
{
}

实现效果:

今日思维导图:

http://www.lryc.cn/news/196109.html

相关文章:

  • 【SA8295P 源码分析 (一)】41 - SA8295所有镜像位置、拷贝脚本、生成QFIL包 及 Fastboot 下载命令介绍
  • AtCoder abc130
  • 数据库、数据中台、数据仓库、数据湖区别
  • 缺失的数据范围,思维,hduoj
  • 极简的MapReduce实现
  • 更新暑假做过的项目(医学数据多标签分类与多标签分割,医学数据二分类)
  • 谷歌浏览器访问127.0.0.1时报错 Failed to read the ‘sessionStorage‘ property from ‘Window‘
  • 云技术分享 | 快速构建 CodeWhisperer 代码生成服务,让 AI 辅助编程
  • 开发万岳互联网医院APP:技术要点和关键挑战
  • 漫谈下一代防火墙与Web应用防火墙的区别
  • 基于马尔可夫随机场的图像去噪算法matlab仿真
  • 【综合类型第 39 篇】HTTP 状态码详解
  • win10 hosts文件修改不生效
  • 网络库OKHttp(1)流程+拦截器
  • 关于 Invalid bound statement (not found): 错误的解决
  • 深入理解强化学习——智能体的类型:有模型强化学习智能体与免模型强化学习智能体
  • vue项目获得开源代码之后跳过登录界面
  • WPS、Excel表格增加一列,序列1到任意大小 / 填充某个范围的数字到列
  • 在 rider 里用配置 Perforce(P4)的注意事项
  • 在Spring中,标签管理的Bean中,为什么使用@Autowired自动装配修饰引用类(前提条件该引用类也是标签管理的Bean)
  • 俄罗斯YandexGPT 2在国家考试中获得高分;OpenAI API开发者快速入门指南
  • Nginx 同一端口下部署多个 Vue3 项目
  • 计算机毕业设计 无人智慧超市管理系统的设计与实现 Javaweb项目 Java实战项目 前后端分离 文档报告 代码讲解 安装调试
  • js构造函数和原型链
  • python中matrix()矩阵和array()数组(待完善)
  • 设计海报都有哪些好用的软件推荐
  • Arcgis中像元值变化问题,拉伸显示的是否为实际像元值范围?
  • oracle库中数据利用datax工具同步至mysql库
  • 【Unity HDRP渲染管线下的WorleyUtilities文件,“Hash”函数】
  • 前端跨域问题解决