qt 实现登录界面

复制代码
#include "mainwidget.h"

MainWidget::MainWidget(QWidget *parent)
    : QWidget(parent)
{
    this->setWindowTitle("有道笔记");
    this->setWindowIcon(QIcon("C:\\Users\\18801\\Desktop\\ydIcon\\icon"));
//    this->setStyleSheet("background-color:white;border-radius:10px");
    this->setStyleSheet("background-color:white;border-radius:10px");
    this->resize(788,1243);
    this->setFixedSize(788,1243);
    this->setWindowFlag(Qt::FramelessWindowHint);//隐藏表头

    QLabel * lab1 = new QLabel(this);
    lab1->resize(150,150);
    lab1->move(638,5);
//    lab1->setStyleSheet("background-color:red");
    lab1->setPixmap(QPixmap("C:\\Users\\18801\\Desktop\\ydIcon\\right_top.png"));
    lab1->setScaledContents(true);//图片自适应

    QLabel * lab2 = new QLabel(this);
    lab2->resize(230,230);
    lab2->move(269,65);
//    lab2->setStyleSheet("background-color:red");
    lab2->setPixmap(QPixmap("C:\\Users\\18801\\Desktop\\ydIcon\\logo.png"));
    lab2->setScaledContents(true);//图片自适应

    QLineEdit * edit1 = new QLineEdit(this);
    edit1->setPlaceholderText("  请输入邮箱账号");
    edit1->setStyleSheet("barder-radius:10px;border: 1px solid gray;");
    edit1->resize(630,70);
    edit1->move(75,365);
    edit1->setMaxLength(18);

    QLineEdit * edit2 = new QLineEdit(this);
    edit2->setPlaceholderText("  请输入邮箱密码");
        edit2->setStyleSheet("barder-radius:10px;border: 1px solid gray;");
    edit2->resize(630,70);
    edit2->move(75,465);
    edit2->setMaxLength(18);
    edit2->setEchoMode(QLineEdit::Password);

    QPushButton * btn1 = new QPushButton(this);
    btn1->setText("登录");
    btn1->setStyleSheet("background-color:rgb(101,136,246);border-radius:10px;color:white");
    btn1->resize(630,70);
    btn1->move(75,665);

    QPushButton * btn2 = new QPushButton(this);
    btn2->setText("手机号登录");
    btn2->setStyleSheet("background-color:rgb(241,243,245);border-radius:10px;");
    btn2->resize(630,70);
    btn2->move(75,775);

    QLabel * lab3 = new QLabel(this);
    lab3->resize(666,294);
    lab3->move(70,926);
//    lab2->setStyleSheet("background-color:red");
    lab3->setPixmap(QPixmap("C:\\Users\\18801\\Desktop\\ydIcon\\bottom.png"));
    lab3->setScaledContents(true);//图片自适应

}

MainWidget::~MainWidget()
{

}
相关推荐
hetao17338374 小时前
2025-12-12~14 hetao1733837的刷题笔记
数据结构·c++·笔记·算法
椰子今天很可爱4 小时前
五种I/O模型与多路转接
linux·c语言·c++
程序员zgh4 小时前
C++ 互斥锁、读写锁、原子操作、条件变量
c语言·开发语言·jvm·c++
獭.獭.6 小时前
C++ -- STL【unordered_set和unordered_map的使用】
c++·stl·unordered_map·unordered_set
star _chen7 小时前
C++ std::move()详解:从小白到高手
开发语言·c++
福尔摩斯张7 小时前
C++核心特性精讲:从C语言痛点出发,掌握现代C++编程精髓(超详细)
java·linux·c语言·数据结构·c++·驱动开发·算法
charlie1145141918 小时前
如何快速在 VS2026 上使用 C++ 模块 — 完整上手指南
开发语言·c++·笔记·学习·现代c++
报错小能手8 小时前
STL_unordered_map
开发语言·c++·哈希算法
历程里程碑9 小时前
C++ 9 stack_queue:数据结构的核心奥秘
java·开发语言·数据结构·c++·windows·笔记·算法
仰泳的熊猫9 小时前
1108 Finding Average
数据结构·c++·算法·pat考试