C++&QT---QT-day1

/*************************登陆窗口制作***************************/
#include "mywindow.h"

MyWindow::MyWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->resize(500,350);
    this->setWindowTitle("登陆界面");
    this->setWindowIcon(QIcon("C:/Users/HP/Desktop/ys.jpg"));
    this->setStyleSheet("background-color:rgb(255,255,255)");
/*************************创建标签******************************/
    QLabel *lab0 = new QLabel(this);
    lab0->resize(500,150);
    QMovie *mv = new QMovie("C:/Users/HP/Desktop/pdx.gif");//设置动图
    lab0->setScaledContents(true);//让图片自动适应大小
    lab0->setMovie(mv);
    mv->start();//动图启动

    QLabel *lab1 = new QLabel(this);
    lab1->resize(20,20);
    lab1->move(100,190);
    lab1->setPixmap(QPixmap("C:/Users/HP/Desktop/userName.jpg"));
    lab1->setScaledContents(true);//让图片自动适应大小

    QLabel *lab2 = new QLabel(this);
    lab2->resize(20,20);
    lab2->move(100,220);
    lab2->setPixmap(QPixmap("C:/Users/HP/Desktop/passwd.jpg"));
    lab2->setScaledContents(true);//让图片自动适应大小

    QLabel *lab3 = new QLabel(this);
    lab3->resize(50,15);
    lab3->setText("自动登陆");
    lab3->move(140,250);

    QLabel *lab4 = new QLabel(this);
    lab4->resize(50,15);
    lab4->setText("记住密码");
    lab4->move(240,250);

    QLabel *lab5 = new QLabel(this);
    lab5->resize(50,15);
    lab5->setText("找回密码");
    lab5->move(340,250);

    QLabel *lab6 = new QLabel(this);
    lab6->resize(50,15);
    lab6->setText("注册账号");
    lab6->move(20,320);

//    QLabel *lab7 = new QLabel(this);
//    lab7->resize(80,80);
//    lab7->move(210,100);
//    lab7->setPixmap(QPixmap("C:/Users/HP/Desktop/pdx2.png"));//添加头像
//    lab7->setScaledContents(true);
/*************************创建行编辑器******************************/
    QLineEdit *ed1 = new QLineEdit(this);
    ed1->move(130,190);
    ed1->resize(270,20);
    ed1->setPlaceholderText("账号");//设置提示占位符

    QLineEdit *ed2 = new QLineEdit(this);
    ed2->move(130,220);
    ed2->resize(270,20);
    ed2->setPlaceholderText("密码");
    ed2->setEchoMode(QLineEdit::Password);//密码模式
/*************************创建按钮**********************************/
    QPushButton *btn1 = new QPushButton("登陆",this);
    btn1->resize(300,35);
    btn1->move(100,285);
    btn1->setStyleSheet("background-color:rgb(3,216,245);border-radius:4");//按钮颜色和按钮圆角

}

MyWindow::~MyWindow()
{
}

C++&QT---QT-day1_第1张图片

C++&QT---QT-day1_第2张图片

你可能感兴趣的:(c++,qt,数据库)