cpp
#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
//设置窗口标题
this->setWindowTitle("QQ");
//设置窗口图标
this->setWindowIcon(QIcon("D:\\qt--project\\qtqt\\pictrue\\pictrue\\qq.png"));
//设置背景颜色
this->setStyleSheet("background-color:#DCF3FF");
//设置窗口大小
this->resize(400,560);
//固定窗口大小
this->setFixedSize(400,560);
//纯净窗口
this->setWindowFlag(Qt::FramelessWindowHint);
//设置账户行编辑器
QLineEdit *edit1=new QLineEdit(this);
//回显模式
edit1->setEchoMode(QLineEdit::Normal);
//移动
edit1->move(40,210);
//设置大小
edit1->resize(325,60);
//设置占位 提示
edit1->setPlaceholderText("输入QQ号");
edit1->setStyleSheet("background-color:white;border-radius:6px");
//设置密码行编辑器
QLineEdit *edit2=new QLineEdit(this);
//回显
edit2->setEchoMode(QLineEdit::Password);
//移动
edit2->move(40,280);
//设置大小
edit2->resize(325,60);
//设置占位 提示
edit2->setPlaceholderText("输入QQ密码");
edit2->setStyleSheet("background-color:white;border-radius:6px");
//登录按钮
QPushButton *btn1=new QPushButton("登录",this);
//移动
btn1->move(45,400);
//大小
btn1->resize(322,50);
btn1->setStyleSheet("background-color:#A3DBFF;border-radius:6px;color:white");
//设置图片标签
QLabel *lab1=new QLabel(this);
//设置
lab1->resize(400,180);
//设置图片
lab1->setPixmap(QPixmap("D:\\桌面\\qtqtq_picture\\86fcc9f21f302b40806f3e5c91b87d30.jpg"));
//自适应
lab1->setScaledContents(true);
QLabel *lab2=new QLabel(this);
lab2->move(0,350);
lab2->resize(305,25);
lab2->setPixmap(QPixmap("D:\\桌面\\qtqtq_picture\\QQ20251015-191731.png"));
QLabel *lab3=new QLabel(this);
lab3->move(0,450);
lab3->resize(400,115);
lab3->setPixmap(QPixmap("D:\\桌面\\qtqtq_picture\\QQ20251015-191758.png"));
}
MyWidget::~MyWidget()
{
}

2.