1.导图
2.mywidget.cpp源码
#include "mywidget.h"
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
//设置窗口大小
this->resize(900,700);
//设置窗口标题
this->setWindowTitle("玄冥科技");
this->setWindowIcon(QIcon("C:\\Users\\14440\\Desktop\\xm.png"));
//添加登录按钮
QPushButton *btn1=new QPushButton("登录",this);
btn1->move(300,500);
btn1->resize(300,100);
btn1->setStyleSheet("background-color:rgb(185,69,255)");
//添加行编辑器
QLineEdit *edit1=new QLineEdit(this);
edit1->setPlaceholderText("账号/邮箱");
edit1->move(200,300);
edit1->resize(500,50);
QLineEdit *edit2=new QLineEdit(this);
edit2->setPlaceholderText("密码");
edit2->move(200,400);
edit2->resize(500,50);
edit2->setEchoMode(QLineEdit::Password);
//添加标签
QLabel *lab1=new QLabel("账号:",this);
lab1->resize(40,50);
lab1->move(160,300);
QLabel *lab2=new QLabel("密码:",this);
lab2->resize(40,50);
lab2->move(160,400);
QLabel *lab3=new QLabel();
lab3->setParent(this);
lab3->resize(900,200);
QMovie *mv=new QMovie("C:\\Users\\14440\\Desktop\\tt.gif");
lab3->setMovie(mv);
mv->start();
lab3->setScaledContents(true);
}
MyWidget::~MyWidget()
{
}
2.现象