QTday1

QTday1_第1张图片

#include "mywidget.h"

myWidget::myWidget(QWidget *parent)
    : QWidget(parent)
{
    //设置窗口名字
    this->setWindowTitle("黑金小金库");
    //设置窗口图片
    this->setWindowIcon(QIcon("C:\\Users\\Administrator\\Desktop\\pictrue\\toy.jpg"));
    //取消窗口头
    //this->setWindowFlag(Qt::FramelessWindowHint);
    //设置窗口与大小
    this->resize(540,410);
    //设置窗口颜色
    this->setStyleSheet("background-color::rgb(255,255,255)");
    //========标签的设置=========
    QLabel *la1=new QLabel(this);
    //设置标签的大小
    la1->resize(540,410);
    //设置标签的背景颜色用于确定标签
    la1->setStyleSheet("background-color:pink");
    //要插入动态图,要创建一个指针来接收动态图
    QMovie *mv=new QMovie("C:\\Users\\Administrator\\Desktop\\pictrue\\heihei.gif");
    //将动态图放入label中
     la1->setMovie(mv);
     //让动态图动起来
     mv->start();
     //自动适应
     la1->setScaledContents(true);
     //========放入图标========
     //创建一个la2放爪子
     QLabel *la2=new QLabel(this);
     //大小
     la2->resize(30,30);
     //移动位置
     la2->move(130,210);
     //放入爪爪
     la2->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\pictrue\\zhuazhua.jpg"));
    //自动适应
     la2->setScaledContents(true);
    //创建la3放入密码
     QLabel *la3=new QLabel(this);
     //移动
     la3->move(130,270);
     //大小
     la3->resize(30,30);
     //放入
     la3->setPixmap(QPixmap("C:\\Users\\Administrator\\Desktop\\pictrue\\passwd.jpg"));
     //适应
     la3->setScaledContents(true);


     //==========放入行编辑器=========
     //创建行编辑器
     QLineEdit *edit1=new QLineEdit(this);
     //移动
     edit1->move(170,210);
     //大小
     edit1->resize(285,40);
     //占位
     edit1->setPlaceholderText("请输入猫咪账号");
      //创建行编辑器
     QLineEdit *edit2=new QLineEdit(this);
     //移动
     edit2->move(170,270);
     //大小
     edit2->resize(285,40);
     //输入
     edit2->setPlaceholderText("密码");
     edit2->setEchoMode(QLineEdit::Password);
     //===========登录按钮============
     QPushButton *btn1=new QPushButton(this);
     //大小
     btn1->resize(330,45);
     //移动
     btn1->move(130,340);
     //编辑按钮
     btn1->setStyleSheet("background-color:rgb(51,51,51);border-radius:10px");
     //输入
     btn1->setText("登录");





}

myWidget::~myWidget()
{
}


QTday1_第2张图片

QTday1_第3张图片

你可能感兴趣的:(大作业)