QT登陆界面

复制代码
#include "mywidget.h"
#include <QLabel>
#include <QMovie> //动图类
#include <QPushButton>
#include <QLineEdit>

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{

    //窗口部分
    //设置窗口大小
    this->resize(540,410);
    //固定窗口大小
    this->setFixedSize(540,410);
    //设置窗口文本
    this->setWindowTitle("华清远见");
    //设置窗口图标
    this->setWindowIcon(QIcon("C:/Users/王毅然/Desktop/pictrue/logo.png"));

    QLabel *lab = new QLabel(this);
    lab->resize(540,150);
    lab->setStyleSheet("background-color:green");
    //设置登陆标签图片
    lab->setPixmap(QPixmap("C:/Users/王毅然/Desktop/pictrue/logo.png"));
    //添加图片自适应
    lab->setScaledContents(true);

    QPushButton *btn = new QPushButton("登录",this);
    btn->move(215,300);
    btn->resize(90,40);
    //background-color背景颜色;border-radius:5px:按钮边框倒角;color:字体颜色
    btn->setStyleSheet("background-color:white;border-radius:5px;color:black");

    //设置密码行编辑器
    QLineEdit *edit1 = new QLineEdit;
    //设置父对象
    edit1->setParent(this);
    edit1->move(200,250);
    edit1->resize(150,30);
    //设置占位,提示
    edit1->setPlaceholderText("QQ密码");
    //设置回显模式
    edit1->setEchoMode(QLineEdit::Password);
    //密码标签
    QLabel *lab2 = new QLabel("密码:",this);
    lab2->resize(40,30);
    lab2->move(150,250);


    //账号
    QLineEdit *edit2 = new QLineEdit(this);
    edit2->move(200,200);
    edit2->resize(150,30);
    //设置占位,提示
    edit2->setPlaceholderText("QQ号码/手机/邮箱");
    //账号号前标签
    QLabel *lab1 = new QLabel("账号:",this);
    lab1->resize(40,30);
    lab1->move(150,200);

    //忘记密码按钮
    QPushButton *btn1 = new QPushButton("忘记密码",this);
    btn1->move(0,370);
    btn1->resize(90,40);
    //background-color背景颜色;border-radius:5px:按钮边框倒角;color:字体颜色
    btn1->setStyleSheet("border-radius:5px;color:black");

    //找回密码按钮
    QPushButton *btn2 = new QPushButton("找回密码",this);
    btn2->move(450,370);
    btn2->resize(90,40);
    //background-color背景颜色;border-radius:5px:按钮边框倒角;color:字体颜色
    btn2->setStyleSheet("border-radius:5px;color:black");
}

MyWidget::~MyWidget()
{

}

界面展示

相关推荐
Z9fish2 小时前
sse哈工大C语言编程练习20
c语言·开发语言·算法
萧鼎2 小时前
Python 包管理的“超音速”革命:全面上手 uv 工具链
开发语言·python·uv
Anastasiozzzz3 小时前
Java Lambda 揭秘:从匿名内部类到底层原理的深度解析
java·开发语言
刘琦沛在进步3 小时前
【C / C++】引用和函数重载的介绍
c语言·开发语言·c++
机器视觉的发动机3 小时前
AI算力中心的能耗挑战与未来破局之路
开发语言·人工智能·自动化·视觉检测·机器视觉
HyperAI超神经3 小时前
在线教程|DeepSeek-OCR 2公式/表格解析同步改善,以低视觉token成本实现近4%的性能跃迁
开发语言·人工智能·深度学习·神经网络·机器学习·ocr·创业创新
R_.L3 小时前
【QT】常用控件(按钮类控件、显示类控件、输入类控件、多元素控件、容器类控件、布局管理器)
开发语言·qt
Zach_yuan4 小时前
自定义协议:实现网络计算器
linux·服务器·开发语言·网络
云姜.4 小时前
java多态
java·开发语言·c++
CoderCodingNo4 小时前
【GESP】C++五级练习题 luogu-P1865 A % B Problem
开发语言·c++·算法