QT——Day1

#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    //窗口
    this->resize(640,800);
    this->setStyleSheet("background-color:#fff;"
                       // "border:3px dashed #40E0D0;"
                        //"margin:3px solid #4169E1;"
                        "background-image:transparent"

            );

    this->setWindowFlag(Qt::FramelessWindowHint);

    /*******************************************************************/

    //label
    QLabel *lab1=new QLabel(this);
    lab1->resize(60,60);
    lab1->setPixmap(QPixmap("C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/qq.png"));
    lab1->move(15,15);
    lab1->setScaledContents(true);

    QLabel *lab2=new QLabel(this);
    lab2->resize(80,60);
    lab2->move(90,15);
   lab2->setText("QQ");
   lab2->setStyleSheet("color:#000");
   QFont font1("times new roman",30);
  // font1.setBold(true);
   lab2->setFont(font1);


    // 令logo有由小变大的动画
   QLabel *lab3=new QLabel(this);
   lab3->resize(640,360);
   lab3->setPixmap(QPixmap("C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/logo.png"));
   lab3->move(0,90);
    lab3->setScaledContents(true);

    // 创建动画并设置动画属性
    QPropertyAnimation *animation = new QPropertyAnimation(lab3, "geometry");
    animation->setDuration(1000); // 设置动画的时间长度(毫秒)
    animation->setStartValue(QRect(0,90, 160,90)); // 设置动画的起始大小
    animation->setEndValue(QRect(0,90, 640, 360)); // 设置动画的结束大小

    // 启动动画
    animation->start();

    //用户图标
    QLabel *lab4=new QLabel(this);
    lab4->resize(60,60);
    lab4->setPixmap(QPixmap("C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/userName.jpg"));
    lab4->move(120,480);
     lab4->setScaledContents(true);

     //密码图标
     QLabel *lab5=new QLabel(this);
     lab5->resize(60,60);
     lab5->setPixmap(QPixmap("C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/passwd.jpg"));
     lab5->move(120,570);
      lab5->setScaledContents(true);
    //lineEdit
    QLineEdit *edit1=new QLineEdit(this);
  edit1->resize(300,60);
edit1->move(210,480);
edit1->setPlaceholderText("QQ号码/手机/邮箱");
edit1->setStyleSheet("background-color:url(C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/manc.jpeg)");

QLineEdit *edit2=new QLineEdit("密码",this);
edit2->resize(edit1->size());
edit2->move(210,570);
qDebug()<<edit2->text();
edit2->setEchoMode(QLineEdit::Password);

//pushbutton
QPushButton *btn1=new QPushButton;
btn1->setParent(this);
btn1->setText("登录");
btn1->resize(100,40);
btn1->move(320,660);
QIcon icon1("C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/login.png");
btn1->setIcon(icon1);
QSize iconSize1(30,30);
btn1->setIconSize(iconSize1);
btn1->setStyleSheet("text-align:left;"
                    "color:black;"
                    "border:3px solid #bfcde4;"
                    "background-color:white");


QPushButton *btn2=new QPushButton;
btn2->setParent(this);
btn2->setText("取消");
btn2->resize(btn1->size());
btn2->move(450,660);
QIcon icon2("C:/Users/Administrator/Desktop/华清培训课程及衍生/QT/icon/cancel.png");
btn2->setIcon(icon2);
btn2->setIconSize(iconSize1);
btn2->setStyleSheet("text-align:left;"
                    "color:black;"
                    "border:3px solid #bfcde4;"
                    "background-color:white");
}

Widget::~Widget()
{

}

在这里插入图片描述

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值