思维导图
作业
自由发挥登录窗口的应用场景,实现一个登录窗口界面。
#include "widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
//窗口
this->setWindowTitle("QQ");
this->setWindowIcon(QIcon("D:\\study\\hqyj\\course\\QT\\pictrue\\qq.png"));
this->setWindowFlag(Qt::FramelessWindowHint);
this->resize(540,410);
this->setStyleSheet("background-color:rgb(255,255,255)");
//动图
QLabel *lab1 = new QLabel(this);
lab1->resize(540,160);
QMovie *mv = new QMovie("D:\\study\\hqyj\\course\\QT\\pictrue\\jntm.gif");
// QMovie *mv = new QMovie("D:\\study\\hqyj\\course\\QT\\pictrue\\qq2.gif");
mv->setParent(this);
lab1->setMovie(mv);
mv->start();
lab1->setScaledContents(true);
//登录账号标签
QLabel *lab2 = new QLabel(this);
lab2->resize(35,35);
lab2->move(120,210);
lab2->setPixmap(QPixmap("D:\\study\\hqyj\\course\\QT\\pictrue\\userName.jpg"));
lab2->setScaledContents(true);
//行编辑器
QLineEdit *le1 = new QLineEdit(this);
le1->move(160,210);
le1->resize(260,35);
le1->setPlaceholderText("QQ/手机号/邮箱");
//密码标签
QLabel *lab3 = new QLabel(this);
lab3->resize(35,35);
lab3->move(120,255);
lab3->setPixmap(QPixmap("D:\\study\\hqyj\\course\\QT\\pictrue\\passwd.jpg"));
lab3->setScaledContents(true);
//行编辑器
QLineEdit *le2 = new QLineEdit(this);
le2->move(160,255);
le2->setPlaceholderText("密码");
le2->resize(260,35);
le2->setEchoMode(QLineEdit::Password);
//按钮
QPushButton *btn = new QPushButton("登录",this);
btn->move(120,300);
btn->resize(300,45);
btn->setStyleSheet("background-color:rgb(0,190,250);color:white;border-radius:10px");
}
Widget::~Widget()
{
}