day0915

#include "hqyj.h"
#include 
#include 

hqyj::hqyj(QWidget *parent)
    : QWidget(parent)

{
   this->setWindowTitle("Widget");
   this->setWindowIcon(QIcon("D:\\230906C++&Qt\\icon\\wodepeizhenshi.png"));
   this->setFixedSize(QSize(400,300));

   QLabel*lab1 = new QLabel(this);
   lab1->resize(QSize(400,133));
   lab1->move(0,0);
   lab1->setPixmap(QPixmap("D:\\230906C++&Qt\\icon\\logo.png"));
   lab1->setScaledContents(true);
   
   QLineEdit *edit1 = new QLineEdit(this);
   edit1->resize(QSize(240,40));
   edit1->move(110,150);
   edit1->setPlaceholderText("账号");

   QLineEdit *edit2 = new QLineEdit(this);
   edit2->resize(QSize(240,40));
   edit2->move(edit1->x(),edit1->y()+55);
   edit2->setPlaceholderText("密码");
   edit2->setEchoMode(QLineEdit::Password);

   QLabel *lab2 = new QLabel(this);
   lab2->resize(50,40);
   lab2->setPixmap(QPixmap("D:\\230906C++&Qt\\icon\\userName.jpg"));
   lab2->setScaledContents(true);
   lab2->move(edit1->x()-60,edit1->y());

   QLabel *lab3 = new QLabel(this);
   lab3->resize(50,40);
   lab3->setPixmap(QPixmap("D:\\230906C++&Qt\\icon\\passwd.jpg"));
   lab3->setScaledContents(true);
   lab3->move(edit2->x()-60,edit2->y());

   QPushButton *btn1 = new QPushButton("登录",this);
   QPushButton *btn2 = new QPushButton("取消",this);

   btn1->resize(QSize(60,30));
   btn2->resize(btn1->size());

   btn1->move(120,edit2->y()+55);
   btn2->move(btn1->x()+120,edit2->y()+55);

   btn1->setIcon(QIcon("D:\\230906C++&Qt\\icon\\login.png"));
   btn2->setIcon(QIcon("D:\\230906C++&Qt\\icon\\cancel.png"));
}

hqyj::~hqyj()
{

}

day0915_第1张图片

你可能感兴趣的:(qt)