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()
{

}

界面展示

相关推荐
独隅2 小时前
在 Lua 中,你可以使用 `os.date()` 函数轻松地将时间戳转换为格式化的时间字符串
开发语言·lua
思麟呀2 小时前
Linux的基础IO流
linux·运维·服务器·开发语言·c++
星释2 小时前
Rust 练习册 :Pythagorean Triplet与数学算法
开发语言·算法·rust
星释2 小时前
Rust 练习册 :Nth Prime与素数算法
开发语言·算法·rust
lkbhua莱克瓦243 小时前
Java基础——集合进阶3
java·开发语言·笔记
多喝开水少熬夜3 小时前
Trie树相关算法题java实现
java·开发语言·算法
QT 小鲜肉3 小时前
【QT/C++】Qt定时器QTimer类的实现方法详解(超详细)
开发语言·数据库·c++·笔记·qt·学习
MeowKnight9583 小时前
【Qt】Qt实践记录3——UDP通信
笔记·qt
lsx2024064 小时前
MySQL WHERE 子句详解
开发语言
Tony Bai4 小时前
【Go模块构建与依赖管理】09 企业级实践:私有仓库与私有 Proxy
开发语言·后端·golang