qt day1

cpp 复制代码
#include "mywidget.h"

MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    //设置窗口标题
    this->setWindowTitle("QQ");
    //设置窗口图标
    this->setWindowIcon(QIcon("D:\\qt--project\\qtqt\\pictrue\\pictrue\\qq.png"));
    //设置背景颜色
    this->setStyleSheet("background-color:#DCF3FF");
    //设置窗口大小
    this->resize(400,560);
    //固定窗口大小
    this->setFixedSize(400,560);
    //纯净窗口
    this->setWindowFlag(Qt::FramelessWindowHint);


    //设置账户行编辑器
    QLineEdit *edit1=new QLineEdit(this);
    //回显模式
    edit1->setEchoMode(QLineEdit::Normal);
    //移动
    edit1->move(40,210);
    //设置大小
    edit1->resize(325,60);
    //设置占位 提示
    edit1->setPlaceholderText("输入QQ号");
    edit1->setStyleSheet("background-color:white;border-radius:6px");

    //设置密码行编辑器
    QLineEdit *edit2=new QLineEdit(this);
    //回显
    edit2->setEchoMode(QLineEdit::Password);
    //移动
    edit2->move(40,280);
    //设置大小
    edit2->resize(325,60);
    //设置占位 提示
    edit2->setPlaceholderText("输入QQ密码");
    edit2->setStyleSheet("background-color:white;border-radius:6px");


    //登录按钮
    QPushButton *btn1=new QPushButton("登录",this);
    //移动
    btn1->move(45,400);
    //大小
    btn1->resize(322,50);
    btn1->setStyleSheet("background-color:#A3DBFF;border-radius:6px;color:white");




    //设置图片标签
    QLabel *lab1=new QLabel(this);
    //设置
    lab1->resize(400,180);
    //设置图片
    lab1->setPixmap(QPixmap("D:\\桌面\\qtqtq_picture\\86fcc9f21f302b40806f3e5c91b87d30.jpg"));
    //自适应
    lab1->setScaledContents(true);

    QLabel *lab2=new QLabel(this);
    lab2->move(0,350);
    lab2->resize(305,25);
    lab2->setPixmap(QPixmap("D:\\桌面\\qtqtq_picture\\QQ20251015-191731.png"));

    QLabel *lab3=new QLabel(this);
    lab3->move(0,450);
    lab3->resize(400,115);
    lab3->setPixmap(QPixmap("D:\\桌面\\qtqtq_picture\\QQ20251015-191758.png"));

}

MyWidget::~MyWidget()
{
}

2.

相关推荐
h***34638 分钟前
Redis安装教程(Windows版本)
数据库·windows·redis
无心水12 分钟前
【Python实战进阶】5、Python字符串终极指南:从基础到高性能处理的完整秘籍
开发语言·网络·python·字符串·unicode·python实战进阶·python工业化实战进阶
4***149042 分钟前
Rust系统工具开发实践指南
开发语言·后端·rust
2501_940943911 小时前
体系课\ Python Web全栈工程师
开发语言·前端·python
rafael(一只小鱼)1 小时前
AI运维开发平台学习
java·开发语言
b***74881 小时前
C++在系统中的内存对齐
开发语言·c++
散峰而望1 小时前
C++数组(三)(算法竞赛)
开发语言·c++·算法·github
4***14901 小时前
C++在系统中的编译优化
开发语言·c++
田姐姐tmner1 小时前
Python切片
开发语言·python
oioihoii2 小时前
C++程序执行起点不是main:颠覆你认知的真相
开发语言·c++