QT模仿QQ登录界面
#include "mywindow.h"
MyWindow::MyWindow(QWidget* parent)
: QMainWindow(parent)
{
//窗口
this->resize(430, 330);
this->setWindowFlag(Qt::FramelessWindowHint);
this->setStyleSheet("background-color:rgb(255,255,255)");
QLabel* lab1 = new QLabel(this);
QMovie* mv = new QMovie("D:\\23071_C++\\QT\\pictrue\\qq2.gif");
lab1->resize(430, 120);
lab1->setMovie(mv);
mv->start();
QLabel* lab2 = new QLabel(this);
lab2->setAttribute(Qt::WA_TranslucentBackground, true);
lab2->setPixmap(QPixmap("D:\\23071_C++\\QT\\pictrue\\qq.png"));
lab2->setScaledContents(true);
lab2->resize(30, 30);
lab2->move(10, 10);
QLabel* lab5 = new QLabel("QQ", this);
lab5->setAttribute(Qt::WA_TranslucentBackground, true);
lab5->setStyleSheet("color:rgb(255,255,255)");
lab5->setFont(QFont("Microsoft YaHei", 17, 50));
lab5->resize(50, 30);
lab5->move(45, 10);
QLabel* lab3 = new QLabel(this);
lab3->setPixmap(QPixmap("D:\\23071_C++\\QT\\pictrue\\QQ2.png"));
lab3->setScaledContents(true);
lab3->resize(18, 18);
lab3->move(98, 155);
QLabel* lab4 = new QLabel(this);
lab4->setPixmap(QPixmap("D:\\23071_C++\\QT\\pictrue\\so.png"));
lab4->setScaledContents(true);
lab4->resize(18, 18);
lab4->move(98, 205);
QLabel* lab12 = new QLabel(this);
lab12->setScaledContents(true);
lab12->setStyleSheet("border-image:url(C:/Users/Administrator/Desktop/test1.webp);border-radius:30px");
lab12->resize(60, 60);
lab12->move(185, 80);
QLineEdit* ed1 = new QLineEdit( this);
ed1->setStyleSheet("background-color:rgb(255,255,255);border-width:0;border-style:outset");
ed1->setFont(QFont("Microsoft YaHei", 13, 0));
ed1->setText("673973541");
ed1->move(120, 150);
ed1->resize(220, 30);
QLabel* lab10 = new QLabel(this);
lab10->setStyleSheet("background-color:rgb(150,150,150)");
lab10->resize(238, 1);
lab10->move(98, 180);
QLineEdit* ed2 = new QLineEdit(this);
ed2->setStyleSheet("background-color:rgb(255,255,255);border-width:0;border-style:outset");
ed2->setFont(QFont("Microsoft YaHei", 13, 0));
ed2->move(120, 200);
ed2->resize(220, 30);
ed2->setEchoMode(QLineEdit::Password);
QLabel* lab11 = new QLabel(this);
lab11->setStyleSheet("background-color:rgb(150,150,150)");
lab11->resize(238, 1);
lab11->move(98, 230);
QCheckBox* hb1 = new QCheckBox("自动登录", this);
hb1->setStyleSheet("color:rgb(150,150,150)");
hb1->move(100, 240);
QCheckBox* hb2 = new QCheckBox("记住密码", this);
hb2->setStyleSheet("color:rgb(150,150,150)");
hb2->move(195, 240);
QLabel* lab8 = new QLabel("找回密码", this);
lab8->setStyleSheet("color:rgb(150,150,150)");
lab8->move(290, 240);
QLabel* lab9 = new QLabel("注册帐号", this);
lab9->setStyleSheet("color:rgb(150,150,150)");
lab9->move(10, 295);
QPushButton* btn = new QPushButton("登录", this);
btn->setStyleSheet("background-color:rgb(23,149,242);color:rgb(255,255,255);border-radius: 3px");
btn->setFont(QFont("Microsoft YaHei", 12, 30));
btn->resize(240, 35);
btn->move(100, 275);
}
MyWindow::~MyWindow()
{
}