9.28 Qt界面

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

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    this->setWindowTitle("Plane");
    this->setWindowIcon(QIcon("C:/Users/EDY/Desktop/递送发送.png"));
    QPushButton *btn1=new QPushButton;

    this->setFixedSize(640,480);
    btn1->setParent(this);   //将界面设置为父组件
    btn1->setText("登录");    //设置按钮文本
    btn1->move(200,350);
    btn1->resize(120,40);
    btn1->setStyleSheet("color:white;background-color:skyblue;border-radius:10px;"); //设置按钮样式表

    QPushButton *btn2=new QPushButton(this);
    btn2->setText("取消");
    btn2->move(btn1->x()+btn1->width()+20,btn1->y());
    btn2->resize(btn1->size());
    btn2->setStyleSheet("background-color:white;border-radius:10px;");

    QLineEdit *acc =new QLineEdit(this);
    acc->resize(260,30);
    acc->move(200,250);
    acc->setAlignment(Qt::AlignCenter);  //文本居中显示
    acc->setEchoMode(QLineEdit::Normal); //设置文本显示模式
    acc->setPlaceholderText("请输入账号"); //设置占位文本

    QLineEdit *pwd =new QLineEdit(this);
    pwd->resize(acc->size());
    pwd->move(acc->x(),acc->y()+acc->height()+20);
    pwd->setEchoMode(QLineEdit::Password);
    pwd->setPlaceholderText("请输入密码");
    pwd->setAlignment(Qt::AlignCenter);

    QLabel *logo=new QLabel;
    logo->setParent(this);
    logo->resize(150,150);
    logo->setPixmap(QPixmap("C:/Users/EDY/Desktop/递送发送.png"));  //插入图片显示
    logo->setScaledContents(true);  //图片填充
    logo->move(250,60);
}

Widget::~Widget()
{
}
相关推荐
叠层归一研究院1 小时前
AGI 系统(八):符号范畴嵌入函子 — SymCat ↪ C_M107 严格化
c语言·开发语言·人工智能·算法·transformer·agi
祈禾1 小时前
Redis三大缓存问题与分布式锁
运维·数据库·redis·笔记·分布式·缓存
明朝百晓生1 小时前
Deep RL learning[2026/8]
开发语言·javascript·人工智能
DBA小马哥2 小时前
关系型数据库核心概念手册:SQL、事务与存储引擎的技术脉络
数据库·sql
丫头,冲鸭!!!2 小时前
记账网站3-连数据库
数据库·个人开发
weixin-a153003083162 小时前
python-装饰器
开发语言·python
灯澜忆梦2 小时前
【MySQL12】进阶篇 | SQL优化
数据库·sql·mysql·性能优化
我的xiaodoujiao2 小时前
快速学习Python基础知识详细图文教程17--类型注解和断点调试
开发语言·python·学习·测试工具
IvorySQL2 小时前
PostgreSQL 日报|PG18.5 回归测试崩溃问题(8 月 12 日)
大数据·数据库·人工智能·postgresql
ltl2 小时前
学习型查询优化器:Neo、Bao、Balsa 与 LLM-CBO
数据库