#include "widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
//设置窗口固定大小
this->setFixedSize(428,300);
//窗口图标&窗口标题
//更改窗口图像
this->setWindowIcon(QIcon("E:/hqyj/Qt/icon_nhgbq8i4bf/QQ.png"));
this->setWindowTitle("QQ");
//logo图片
lab1 = new QLabel(this);
lab1->resize(428,100);
lab1->move(0,0);
lab1->setStyleSheet("background-color:pink;");
//头像
QPixmap pixmap("E:/hqyj/Qt/icon_nhgbq8i4bf/touxiang.jpeg"); // 加载图像
QPixmap roundedPixmap(pixmap.size()); // 创建一个圆形图像
roundedPixmap.fill(Qt::transparent); // 填充透明色
QPainter painter(&roundedPixmap);
painter.setRenderHint(QPainter::Antialiasing, true); // 设置抗锯齿
QPainterPath path;
path.addEllipse(roundedPixmap.rect()); // 创建圆形路径
painter.setClipPath(path); // 设置剪裁路径
painter.drawPixmap(pixmap.rect(), pixmap); // 在剪裁的路径内绘制原图像
label = new QLabel(this);
label->setPixmap(roundedPixmap); // 将圆形图像设置给 QLabel
label->resize(68,68);
label->move(184,60);
label->setScaledContents(true);
//账户
lab2 = new QLabel(this);
edit1 = new QLineEdit("QQ号码/手机/邮箱",this);
edit1->resize(200,30);
edit1->move(140,130);
lab2->resize(25,25);
lab2->move(110,130);
lab2->setScaledContents(true);
lab2->setPixmap(QPixmap("E:/hqyj/Qt/icon_nhgbq8i4bf/denglu.png"));
//手动构造一个行编辑器,密码
lab3 = new QLabel(this);
edit2 = new QLineEdit(this);
edit2->resize(200,30);
edit2->move(140,175);
edit2->setEchoMode(QLineEdit::Password); //设置回显模式为密文模式
edit2->setPlaceholderText("密码"); //设置占位文本
lab3->resize(25,25);
lab3->move(110,175);
lab3->setScaledContents(true);
lab3->setPixmap(QPixmap("E:/hqyj/Qt/icon_nhgbq8i4bf/denglumima.png"));
//自动登录、取消密码
box1 = new QCheckBox;
box1->setParent(this); //将该界面作为组件的父组件
//重新设置大小
box1->resize(80,50);
box1->setText("自动登录");
box1->move(110,195);
box2 = new QCheckBox(this); //在构造时给定父组件
//重新设置大小
box2->resize(80,50);
box2->setText("记住密码");
box2->move(200,195);
//找回密码
btn1 = new QPushButton(this);
btn1->setText("找回密码");
btn1->resize(80,45);
btn1->move(275,197);
btn1->setStyleSheet("border:none;");
//登录
btn2 = new QPushButton(this);
btn2->setText("登录");
btn2->resize(230,30);
btn2->move(110,240);
btn2->setStyleSheet("background-color:skyblue;");
//注册账号
btn3 = new QPushButton(this);
btn3->setText("注册账号");
btn3->resize(80,45);
btn3->move(0,260);
btn3->setStyleSheet("border:none;");
}
Widget::~Widget()
{
}