作业:
编写一个类似图片的
#include "burger.h"
burger::burger(QWidget *parent)
: QWidget(parent)
{
//设置初始尺寸
this->resize(400,320);
//设置尺寸最大值最小值
this->setMaximumSize(400,320);
this->setMinimumSize(400,320);
//设置窗口标题
this->setWindowTitle("From Cecilla");
//设置图标、Icon
this->setWindowIcon(QIcon("C:\\Users\\asus\\Pictures\\1.1\\IMG_0203.png"));
//设置背景色
//this->setStyleSheet("background-color:#008B8B");
//设置透明度
//this->setWindowOpacity(0.8);
//设置纯净窗口
//this->setWindowFlags(Qt::FramelessWindowHint);
//移动窗口位置
this->move(50,100);
QPushButton *bt1 = new QPushButton("登录",this);
bt1->resize(70,35);
bt1->move(100,240);
bt1->setIcon(QIcon("C:\\Users\\asus\\Pictures\\screenshots\\112.jpg"));
bt1->setStyleSheet("background-color:#FFB6C1;"
"border-radius:10px;");
QPushButton *bt2 = new QPushButton("取消",this);
bt2->resize(70,35);
bt2->move(230,240);
bt2->setIcon(QIcon("C:\\Users\\asus\\Pictures\\screenshots\\112.jpg"));
bt2->setStyleSheet("background-color:#6495ED;"
"border-radius:10px;");
QLineEdit *e1 = new QLineEdit(this);
e1->resize(150,20);
e1->move(160,150);
e1->setPlaceholderText("账号/邮箱/手机号");
QLineEdit *e2 = new QLineEdit(this);
e2->resize(150,20);
e2->move(160,190);
e2->setPlaceholderText("密码");
e2->setEchoMode(QLineEdit::Password);
QLabel *l1=new QLabel(this);
l1->resize(400,130);
l1->setScaledContents(true);
QPixmap q("C:\\Users\\asus\\Pictures\\1.1\\IMG_0092.jpg");
l1->setPixmap(q);
QLabel *l2=new QLabel(this);
l2->resize(20,20);
l2->move(120,150);
l2->setScaledContents(true);
QPixmap w("C:\\Users\\asus\\Pictures\\screenshots\\112.jpg");
l2->setPixmap(w);
QLabel *l3=new QLabel(this);
l3->resize(20,20);
l3->move(120,190);
l3->setScaledContents(true);
QPixmap e("C:\\Users\\asus\\Pictures\\screenshots\\112.jpg");
l3->setPixmap(e);
}
burger::~burger()
{
}
注释:
思维导图: