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()
{
}
相关推荐
AAA@峥17 分钟前
系统化学习 MySQL:数据类型、库表管理、增删改查全解析
数据库·学习·mysql
神明不懂浪漫1 小时前
【第七章】Java中的常用类
java·开发语言·前端·经验分享·笔记
流星白龙7 小时前
【Redis】2.Redis重大版本
数据库·redis·junit
流星白龙7 小时前
【Redis】7.Hash表
数据库·redis·哈希算法
流星白龙8 小时前
【Redis】4.基本全局命令
数据库·redis·缓存
程序喵大人9 小时前
【C++进阶】STL容器与迭代器 - 01 STL 容器先解决元素放在哪里
开发语言·c++·stl
王八八。9 小时前
Navicat 17破解版下载安装教程 附安装激活步骤(2026 最新版)
数据库·navicat
cui_ruicheng9 小时前
Python从入门到实战(十六):多进程编程
开发语言·python
Jelena1577958579210 小时前
电商运营分析数据比价接口实战:多平台价格监控与智能决策系统
java·大数据·数据库
wdfk_prog11 小时前
嵌入式面试真题第 15 题:不可恢复异常后的通用崩溃快照、调用栈保存与离线分析架构
linux·开发语言·面试·架构