QT窗口gui

head

#ifndef WORKWIDGET_H
#define WORKWIDGET_H

#include 
#include 
#include 
#include 
#include 
#include //按钮
#include //文本框
#include //标签
#include 
class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    QLabel *l1,*l2,*l3,*l4,*l5,*l7,*l6;//文本标签
    QPushButton *b1,*b2;//按钮
    QLineEdit *le1,*le2;//input框
    QCheckBox *cb1,*cb2;//复选框
};

#endif // WORKWIDGET_H

widget.cpp

#include "workwidget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    //设置窗口大小
    this->setFixedSize(430,340);
    //设置icon
    this->setWindowIcon(QIcon("F:/QT/icon_/icon_nhgbq8i4bf/QQ.png"));
    //设置名称
    this->setWindowTitle("QQ");
    this -> setStyleSheet("background-color:#ffffff;");
    //设置标签1
    l1=new QLabel(this);
    //设置大小
    l1->resize(430,130);
    //设置颜色
    l1->setStyleSheet("background-color:#00a1db;");
    //设置头像
    l2=new QLabel(this);
    l2->resize(60,60);
    l2->move(185,100);
    l2->setStyleSheet("QLabel {background-image: url(F:/QT/icon_/icon_nhgbq8i4bf/tx.png);border-radius:30px;}");
    //登录账号标签
    l3=new QLabel(this);
    l3->resize(25,25);
    l3->setScaledContents(true);
    l3->setPixmap(QPixmap("F:/QT/icon_/icon_nhgbq8i4bf/denglu.png"));
    l3->move(100,175);
    //登录账号下划线
    l5=new QLabel(this);
    l5->resize(230,2);
    l5 -> setStyleSheet("border-radius:1px;background-color:#00a1db;");
    l5->move(100,210);
    //登录密码标签
    l4=new QLabel(this);
    l4->resize(25,25);
    l4->setScaledContents(true);
    l4->setPixmap(QPixmap("F:/QT/icon_/icon_nhgbq8i4bf/denglumima.png"));
    l4->move(100,218);
    //登录密码下划线
    l6=new QLabel(this);
    l6->resize(230,2);
    l6 -> setStyleSheet("border-radius:1px;background-color:#00a1db;");
    l6->move(100,250);
    //账号框
    le1 = new QLineEdit(this);
    le1 -> resize(200,25);
    le1 -> setStyleSheet("border-radius:3px;border: none;");
    le1 -> setPlaceholderText("QQ号码/手机号/邮箱");
    le1 -> move(130,175);
    //密码框
    le2 = new QLineEdit(this);
    le2 -> resize(200,25);
    le2 ->setEchoMode(QLineEdit::Password);
    le2 -> setStyleSheet("border-radius:3px;border: none;");
    le2 -> setPlaceholderText("密码");
    le2 -> move(130,218);
    //复选框
    cb1 = new QCheckBox("记住密码",this);
    cb1 -> move(100,255);
    cb2 = new QCheckBox("自动登录",this);
    cb2 -> move(190,255);
    //找回密码
    l7=new QLabel("找回密码",this);
    l7->resize(56,18);
    l7->move(280,255);
    //登录按钮
    b1=new QPushButton("登录",this);
    b1->resize(100,35);
    b1->move(100,280);
    b1 -> setStyleSheet("background-color:#00a1db;border-radius:5px;border: none;");
    //取消按钮
    b2=new QPushButton("取消",this);
    b2->resize(100,35);
    b2->move(230,280);
    b2 -> setStyleSheet("background-color:#00a1db;border-radius:5px;border: none;");
}

Widget::~Widget()
{

}

QT窗口gui_第1张图片

你可能感兴趣的:(qt,开发语言)