#include "widget.h"
#include "ui_widget.h"widget::widget(QWidget *parent): QMainWindow(parent), ui(new Ui::widget)
{ui->setupUi(this);//设置尺寸this->resize(800,600);//固定尺寸this->setFixedSize(800,600);//设置窗口标题this->setWindowTitle("还不谢谢小明哥");//设置窗口图标this->setWindowIcon(QIcon("C:\\Users\\qiujunhang\\Pictures\\Saved Pictures\\OIP-C.jfif"));//设置背景色this->setStyleSheet("background-color:pink;");//设置透明度this->setWindowOpacity(0.8);//添加logoQLabel *lab1 = new QLabel;lab1->setParent(this);lab1->resize(40,40);lab1->setPixmap(QPixmap("C:\\Users\\qiujunhang\\Desktop\\icon\\userName.jpg"));lab1->move(250,300);lab1->setScaledContents(true);QLabel *lab2 = new QLabel(this);lab2->resize(40,40);lab2->setPixmap(QPixmap("C:\\Users\\qiujunhang\\Desktop\\icon\\passwd.jpg"));lab2->move(250,350);lab2->setScaledContents(true);QLabel *lab3 = new QLabel(this);lab3->resize(800,200);lab3->setPixmap(QPixmap("C:\\Users\\qiujunhang\\Desktop\\icon\\logo.png"));lab3->move(0,0);lab3->setScaledContents(true);//设置行编辑器QLineEdit *edit1=new QLineEdit;edit1->setParent(this);edit1->resize(200,40);edit1->move(300,300);edit1->setPlaceholderText("账号");QLineEdit *edit2=new QLineEdit(this);edit2->move(300,350);edit2->setPlaceholderText("密码");edit2->resize(200,40);edit2->setEchoMode(QLineEdit::Password);//设置按钮QPushButton *btn1=new QPushButton;btn1->setParent(this);btn1->setText("enter");btn1->resize(100,40);btn1->move(600,500);btn1->setIcon(QIcon("C:\\Users\\qiujunhang\\Desktop\\icon\\login.png"));QPushButton *btn2 = new QPushButton("cancel", this);btn2->move(700,500);btn2->setIcon(QIcon("C:\\Users\\qiujunhang\\Desktop\\icon\\cancel.png"));btn2->resize(100,40);
}widget::~widget()
{delete ui;
}