QT day1

2024-01-08 20:28:39

1自己做一个界面

原版

我的

code

#include "qq.h"

qq::qq(QWidget *parent)
    : QWidget(parent)
{
    //this->resize(880,410);
    this->setWindowIcon(QIcon("C:\\Users\\CWG\\Desktop\\file\\qt\\mypicture\\steam1.png"));
    this->setFixedSize(880,550);
    this->setWindowFlag(Qt::FramelessWindowHint);
    this->setStyleSheet("background-color:rgb(25,26,30)");


    //创建存放动图的标签
    QLabel *lab1 = new QLabel(this);
    lab1->move(50,40);
    lab1->resize(212,86);
    lab1->setPixmap(QPixmap("C:\\Users\\CWG\\Desktop\\file\\qt\\mypicture\\steam.png"));
    lab1->setScaledContents(true);
    //QMovie *mv = new QMovie("",lab1);

    //创建label线时用账户户名称登录
    QLabel *lab2 = new QLabel("用账户名称登录",this);
    lab2->move(50,130);
    lab2->resize(110,20);
    lab2->setStyleSheet("color:rgb(27,112,180);background-color:rgb(25,26,30)");

    //创建用于显示密码的label
    QLabel *lab3 = new QLabel("密码",this);
    lab3->move(50,220);
    lab3->resize(110,20);
    QPalette pe;
    pe.setColor(QPalette::WindowText,Qt::gray);
    lab3->setPalette(pe);
    lab3->setStyleSheet("background-color:rgb(25,26,30)");

    //创建用于显示用二维码登录这句话的label
    QLabel *lab4 = new QLabel("或者用二维码登录",this);
    lab4->move(585,130);
    lab4->resize(150,20);
    //pe.setColor(QPalette::WindowText,Qt::blue);
    //lab4->setPalette(pe);
    lab4->setStyleSheet("color:rgb(27,112,180);background-color:rgb(25,26,30)");

    //创建一个用于显示二维码的label
    QLabel *lab5 = new QLabel(this);
    lab5->move(580,155);
    lab5->resize(255,255);
    lab5->setPixmap(QPixmap("C:\\Users\\CWG\\Desktop\\file\\qt\\mypicture\\ma.png"));
    lab5->setScaledContents(true);


    QLabel *lab6 = new QLabel("通过二维码使用steam手机应用登录",this);
    lab6->resize(250,20);
    lab6->move(585,425);
    pe.setColor(QPalette::WindowText,Qt::gray);
    lab6->setPalette(pe);
    lab6->setStyleSheet("background-color:rgb(25,26,30)");

    QLabel *lab7 = new QLabel("还没有steam账户?",this);
    lab7->resize(150,20);
    lab7->move(590,475);
    pe.setColor(QPalette::WindowText,Qt::gray);
    lab7->setPalette(pe);
    lab7->setStyleSheet("background-color:rgb(25,26,30)");

    //lab2->setTextFormat()
    //输入账户的textbox
    QLineEdit *edit1 = new QLineEdit(this);
    edit1->resize(480,50);
    edit1->setStyleSheet("background-color:rgb(57,60,68)");
    edit1->move(50,155);

    //创建密码框
    QLineEdit *edit2 = new QLineEdit(this);
    edit2->resize(480,50);
    edit2->setStyleSheet("background-color:rgb(57,60,68)");
    edit2->move(50,245);
    edit2->setEchoMode(QLineEdit::Password);

    QPushButton *btn1 = new QPushButton("登录",this);
    btn1->move(120,340);
    btn1->resize(340,55);
    btn1->setStyleSheet("background-color:rgb(30,140,255);border-radius:10px");
    pe.setColor(QPalette::WindowText,Qt::white);
    btn1->setPalette(pe);

    QPushButton *btn2 = new QPushButton("创建免费账户",this);
    btn2->resize(100,20);
    btn2->move(740,475);
    btn2->setStyleSheet("color:gray;background-color:rgb(25,26,30);text-decoration:underline");

    QPushButton *btn3 = new QPushButton("请求帮助,我无法登录",this);
    btn3->move(50,475);
    btn3->resize(200,20);
    btn3->setStyleSheet("color:gray;background-color:rgb(25,26,30);text-decoration:underline");


}

qq::~qq()
{
}

?作业2:思维导图

文章来源:https://blog.csdn.net/weixin_51788918/article/details/135464763
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。