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.

相关推荐
Escalating_xu6 小时前
【MySQL】事务管理(上):从 ACID 到提交回滚,把一次转账真正做完整
android·数据库·mysql
不喝水就会渴8 小时前
「不想上班」实战系列:密码卡证保险箱 —— 主密钥存入 Asset,密文落库 RDB【鸿蒙心迹】
数据库·oracle
西泽XIZ98 小时前
微信小程序网络与数据库交互实践:从后端环境搭建到数据渲染
网络·数据库·微信小程序·小程序
两点王爷9 小时前
Java 面试高频:JWT、Cookie、Session、Token 鉴权详解
java·开发语言·面试
ShineWinsu10 小时前
对于Qt:条件变量(QWaitCondition)的解析
c++·qt·面试·线程·条件变量·客户端·锁
TiDB 社区干货传送门10 小时前
平凯数据库携手东软医保共筑智慧医保,构建可靠、安全、开放的数据底座
数据库·tidb·国产数据库
微笑星河q11 小时前
C++高阶之【多态】
开发语言·c++
YYYing.12 小时前
【Mysql剑指offer系列 (七) 】MySQL性能调优和架构
数据库·mysql·八股
Decay__13 小时前
PostgreSQL WAL 归档与时间点恢复 —— WAL 连续归档、recovery_target 时点恢复与 pg_rewind
运维·数据库·sql·postgresql