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()
{
}
相关推荐
峥嵘life4 分钟前
Android 17 具体代码新特性总结
android·开发语言·网络
骑着蜗牛撵大象3275 分钟前
从0实现C++ AI大模型接入SDK(十):DataManager业务实现——数据库CRUD、事务管理与数据一致性
数据库·c++·人工智能·sqlite·事务管理·数据一致性
HackTwoHub7 分钟前
ARTEX 开源后继版本持续维护,AI 自主渗透测试系统保留完整能力12月持续更新
开发语言·人工智能·web安全·网络安全·开源·系统安全·php
阿正的梦工坊12 分钟前
深入理解 B+ Tree:从二叉搜索树、B Tree 到数据库索引的底层原理
数据库
Lethehong31 分钟前
从轻点到落块:Rokid AIUI 游戏《叠叠乐》开发实践
java·开发语言·游戏
夜雪一千1 小时前
PostgreSQL 的触发器如何写
linux·数据库·postgresql
全速向光1 小时前
用 Three.js 从零打造一棵会发光的 3D 圣诞树
开发语言·javascript·3d
codeejun1 小时前
每日一Go·MySQL-28、账户转账事务设计
开发语言·mysql·golang
IvorySQL1 小时前
PostgreSQL 日报|拟废弃 money 类型(12 月 3 日)
数据库·postgresql
箓维1 小时前
MySQL_数据类型
数据库·mysql