DAY 1 QT 创建QQ界面

#include "mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    //创建一个窗口,改变窗口标签名和窗口标签图标
    this -> resize(640,500);//设置窗口界面大小
    this -> setWindowTitle("QQ登录");//设置窗口标题
    this -> setWindowIcon(QIcon("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\qq.png"));//设置窗口图标标题
    //    this -> setStyleSheet("background-color:rgb(20,254,255)");//设置整个窗口颜色
    //    this -> setWindowFlag(Qt::FramelessWindowHint);

    //创建一个上面的大标签放动图
    QLabel *lab1 =new QLabel(this);//创建一个标签,并归属到此父类
    //lab1 -> move(0,0);//设置标签起始位置为0,0
    lab1 -> resize(640,190);//设置标签大小

    QMovie *mv =new QMovie("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\qg.gif");
    mv ->start();

    lab1 -> setMovie(mv);
    //lab1 -> setStyleSheet("background-color:rgb(12,204,205)");//设置整个窗口颜色

    lab1 -> setScaledContents(true);

    QLabel *lab2 =new QLabel(this);
    lab2 -> move(16,20);
    lab2 -> resize(40,40);
    lab2->setPixmap(QPixmap("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\qq.png"));
    lab2->setScaledContents(true);

    QLabel *lab3 =new QLabel(this);
    lab3 -> move(155,230);
    lab3 -> resize(40,40);/*
   lab1 -> setStyleSheet("background-color:rgb(1,204,205)");//设置整个窗口颜色*/
    lab3->setPixmap(QPixmap("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\11.jpg"));
    lab3->setScaledContents(true);

    QLabel *lab4 =new QLabel(this);
    lab4 -> move(153,280);
    lab4 -> resize(45,45);/*
  lab1 -> setStyleSheet("background-color:rgb(1,204,205)");//设置整个窗口颜色*/
    lab4->setPixmap(QPixmap("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\22.jpg"));
    lab4->setScaledContents(true);
    //账号
    QLineEdit *edt1 = new QLineEdit(this);
    edt1 -> move(195,224);
    edt1 -> resize(340,46);
    edt1 -> setPlaceholderText("姓名/账号/手机号");
    edt1 -> setStyleSheet("background-color:rgb(247,247,247)");
    QFont font("Airal",10);
    edt1 -> setFont(font);
    //密码
    QLineEdit *edt2 = new QLineEdit(this);
    edt2 -> move(195,276);
    edt2 -> resize(340,46);
    edt2 -> setPlaceholderText("QQ密码");
    edt2 -> setStyleSheet("background-color:rgb(247,247,247)");
    //QFont font("Airal",12);
    edt2 -> setFont(font);
    edt2-> setEchoMode(QLineEdit::Password);

    //按键
    QPushButton *butt =new QPushButton("登  录",this);
    butt -> move(153,370);
    butt ->resize(380,55);
    butt -> setFont(font);
    butt -> setStyleSheet("background-color:rgb(58,208,255);color:white;font-size:20px;font-weight");


    QPushButton *butt1 =new QPushButton("注册账号",this);
    butt1 -> move(15,450);
    butt1 -> resize(90,30);
    butt1 -> setFont(font);
    butt1 -> setStyleSheet("background-color:rgb(247,247,247);font-size:20px;bold:radius:8");
    QPushButton *butt2 =new QPushButton("自动登录",this);
    butt2 -> move(195,330);
    butt2 -> resize(83,25);
    butt2 -> setFont(font);
    /*   butt2-> setEnabled(false);//设置按钮可按*/
    butt2 -> setStyleSheet("background-color:rgb(247,247,247);font-size:15px;bold:radius:8");
    QPushButton *butt3 =new QPushButton("记录密码",this);
    butt3 -> move(321,330);
    butt3 -> resize(83,25);
    butt3 -> setFont(font);
    //                         butt3-> setEnabled(false);//设置按钮可按不可按下
    butt3 -> setStyleSheet("background-color:rgb(247,247,247);font-size:15px;bold:radius:8");
    QPushButton *butt4 =new QPushButton("找回密码",this);
    butt4 -> move(447,330);
    butt4 -> resize(83,25);
    butt4 -> setFont(font);
    //                           butt4-> setEnabled(false);//设置按钮可按不可按下
    butt4 -> setStyleSheet("background-color:rgb(247,247,247);font-size:15px;border:radius:8");
    QPushButton *butt5 =new QPushButton(this);
    butt5 -> move(575,435);
    //    butt5 -> resize(100,100);
    butt5 ->setIcon(QIcon("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\33.png"));//tubiao
    butt5->setIconSize(QSize(butt5->width(), butt5->height())); // 图标适应按钮大小
    butt5->setFixedSize(60, 60); // 设置按钮大小
    butt5-> setEnabled(true);//设置按钮可按不可按下

//  lab5 -> setStyleSheet("background-color:rgb(1,204,205)");//设置整个窗口颜色*/



    QLabel *lab5 =new QLabel(this);
    const QString label_style =
        "min-width:110px;min-height:110px;max-width:110px;max-height:110px;border-radius:55px;border:0.5px solid black";
   lab5->setStyleSheet(label_style);


    lab5 -> move(265,115);
//   lab5 -> resize(100,100);
 QPixmap pixmap("C:\\Users\\26413\\Desktop\\C基础\\QT\\pictrue\\pictrue\\44.png");
//     QPainterPath path;
//     path.addEllipse(QRectF(0, 0, pixmap.width(), pixmap.height())); // 设置为圆形
//    QPainter painter;
//     painter.setClipPath(path); // 将QPainter设置为圆形
//     painter.drawPixmap(0, 0, pixmap); // 绘制图像

lab5->setPixmap(pixmap);
   lab5->setScaledContents(true);




}

MyWidget::~MyWidget()
{
}

DAY 1 QT 创建QQ界面_第1张图片

你可能感兴趣的:(qt)