作业--day42

界面设计

MyProWin::MyProWin(QWidget *parent)
    : QMainWindow(parent)
{
    /**********窗口主体**********/

    //窗口大小
    this->setFixedSize(644, 493);
    this->setWindowTitle("QQ");
    this->setWindowIcon(QIcon("C:/Users/10988/Downloads/pictrue/pictrue/qq.png"));
    this->setStyleSheet("background-color:white");
    this->setWindowFlag(Qt::FramelessWindowHint);

    /*********标签内容**********/

    //上部内容label
    QLabel *upper_lab =  new QLabel(this);
    upper_lab->resize(644, 290);
    upper_lab->setScaledContents(true);
    QMovie *upper_mv = new QMovie("C:/Users/10988/Downloads/pictrue/pictrue/qq2.gif");
    upper_lab->setMovie(upper_mv);
    upper_mv->start();

    //QQ的图标label
    QLabel *qq_upper_lab =  new QLabel(this);
    qq_upper_lab->move(30, 20);
    qq_upper_lab->setScaledContents(true);
    qq_upper_lab->setPixmap(QPixmap("C:/Users/10988/Downloads/pictrue/pictrue/QQicon.png"));
    qq_upper_lab->resize(50,50);
    qq_upper_lab->setStyleSheet("background-color:transparent");

    //账号label
    QLabel *account_lab = new QLabel(this);
    account_lab->move(145,260);
    account_lab->setScaledContents(true);
    account_lab->resize(25,30);
    account_lab->setPixmap(QPixmap("C:/Users/10988/Downloads/pictrue/pictrue/QQaccount.png"));

    //密码label
    QLabel *pwd_lab = new QLabel(this);
    pwd_lab->move(145,310);
    pwd_lab->setScaledContents(true);
    pwd_lab->resize(25,30);
    pwd_lab->setPixmap(QPixmap("C:/Users/10988/Downloads/pictrue/pictrue/qqpwd.png"));

    //头像label
    QLabel *img_lab = new QLabel(this);
    img_lab->move(270,140);
    img_lab->setScaledContents(true);
    img_lab->resize(100,100);
    //设置透明背景
    img_lab->setStyleSheet("background-color:transparent");
    img_lab->setPixmap(QPixmap("C:/Users/10988/Downloads/pictrue/pictrue/boy_h.png"));

    //找回密码label
    QLabel *fpwd_lab = new QLabel(this);
    fpwd_lab->move(440, 350);
    fpwd_lab->setScaledContents(true);
    fpwd_lab->setText("找回密码");

    //注册账号label
    QLabel *reg_lab = new QLabel(this);
    reg_lab->move(30, 450);
    reg_lab->setScaledContents(true);
    reg_lab->setText("注册账号");

    //二维码label
    QLabel *qr_lab = new QLabel(this);
    qr_lab->move(580,450);
    qr_lab->setScaledContents(true);
    qr_lab->resize(25,25);
    qr_lab->setPixmap(QPixmap("C:/Users/10988/Downloads/pictrue/pictrue/qr.png"));

    /**********输入框**************/

    //账号输入框
    QLineEdit *account_le = new QLineEdit(this);
    account_le->setPlaceholderText("QQ号码/手机/邮箱");
    account_le->resize(345,30);
    account_le->move(175, 260);

    //密码输入框
    QLineEdit *pwd_le = new QLineEdit(this);
    pwd_le->setEchoMode(QLineEdit::Password);
    pwd_le->resize(345,30);
    pwd_le->move(175, 310);

    /***********确认框************/

    //自动登录框
    QCheckBox *login_ck = new QCheckBox(this);
    login_ck->move(145, 350);
    login_ck->setText("自动登录");

    //记住密码框
    QCheckBox *pwd_ck = new QCheckBox(this);
    pwd_ck->move(300, 350);
    pwd_ck->setText("记住密码");

    /*************按钮*************/
    //登录按钮
    QPushButton *login_bnt = new QPushButton(this);
    login_bnt->move(145,400);
    login_bnt->resize(370, 60);
    login_bnt->setText("登录");
    login_bnt->setStyleSheet("background-color:rgb(70,127,231)");
}

作业--day42_第1张图片

思维导图

你可能感兴趣的:(c++)