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

}

界面展示

相关推荐
楼田莉子4 小时前
C++学习:异常及其处理
开发语言·c++·学习·visual studio
fsnine4 小时前
Python Web框架对比与模型部署
开发语言·前端·python
海梨花4 小时前
【八股笔记】SSM
java·开发语言·笔记·后端·面试·框架
JAVA学习通4 小时前
OJ竞赛平台----C端题目列表
java·开发语言·jvm·vue.js·elasticsearch
想唱rap5 小时前
C++ string类的使用
开发语言·c++·笔记·算法·新浪微博
胖咕噜的稞达鸭5 小时前
C++中的父继子承(2)多继承菱形继承问题,多继承指针偏移,继承组合分析+高质量习题扫尾继承多态
c语言·开发语言·数据结构·c++·算法·链表·c#
JAVA学习通5 小时前
基本功 | 一文讲清多线程和多线程同步
java·开发语言·多线程
啦啦9117145 小时前
如何理解Java中的并发?
java·开发语言
api_180079054605 小时前
异步数据采集实践:用 Python/Node.js 构建高并发淘宝商品 API 调用引擎
大数据·开发语言·数据库·数据挖掘·node.js