QT day1

作业:

编写一个类似图片的

#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()
{
}

注释:

思维导图:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值