QT day1

QT day1_第1张图片

#include "widget.h"
#include "ui_widget.h"
#include 
#include 
#include 
#include 

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    this->setWindowIcon(QIcon("D:/QTProj/C++/icon/QQ.png"));
    setWindowTitle("Login");
    setFixedSize(500,400);
    QLabel *labLogo = new QLabel(this);
    labLogo->resize(500,150);
    labLogo->setPixmap(QPixmap("D:/QTProj/C++/icon/logo.jpg"));
    labLogo->setScaledContents(true);
    QLabel *labAccount = new QLabel(this);
    labAccount->resize(50,50);
    labAccount->setPixmap(QPixmap("D:/QTProj/C++/icon/denglu.png"));
    labAccount->setScaledContents(true);
    labAccount->move(100,200);
    QLabel *labPassword = new QLabel(this);
    labPassword->resize(50,50);
    labPassword->setPixmap(QPixmap("D:/QTProj/C++/icon/denglumima.png"));
    labPassword->setScaledContents(true);
    labPassword->move(100,280);
    QLineEdit *editAccount = new QLineEdit(this);
    editAccount->resize(200,50);
    editAccount->move(180,200);
    editAccount->setPlaceholderText("账号");
    QLineEdit *editPassword = new QLineEdit(this);
    editPassword->resize(200,50);
    editPassword->move(180,280);
    editPassword->setPlaceholderText("密码");
    editPassword->setEchoMode(QLineEdit::Password);
    QPushButton* btnLogin = new QPushButton("登录",this);
    btnLogin->setIcon(QIcon("D:/QTProj/C++/icon/denglu_1.png"));
    btnLogin->resize(100,50);
    btnLogin->move(250,340);
    QPushButton* btnCancel = new QPushButton("取消",this);
    btnCancel->setIcon(QIcon("D:/QTProj/C++/icon/quxiao.png"));
    btnCancel->resize(100,50);
    btnCancel->move(380,340);
}

Widget::~Widget()
{
    delete ui;
}

QT day1_第2张图片

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