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()
{
}
相关推荐
TG_yilongcloud1 分钟前
阿里云国际代理:怎么保障数据库在凭据变更过程中的安全与稳定?
数据库·安全·阿里云·云计算
恣艺27 分钟前
Redis有序集合(ZSet):排行榜功能的最优解,原理与实战
数据库·chrome·redis
NG WING YIN35 分钟前
Golang關於信件的
开发语言·深度学习·golang
Sunny_yiyi40 分钟前
Java根据模版导出PDF文件
java·开发语言·pdf
麦兜*42 分钟前
MongoDB 与 GraphQL 结合:现代 API 开发新范式
java·数据库·spring boot·mongodb·spring·maven·graphql
橘子1344 分钟前
C++实战:搜索引擎项目(二)
开发语言·c++·搜索引擎
赵谨言1 小时前
基于python人物头像的卡通化算法设计与实现
开发语言·经验分享·python
应用市场1 小时前
Qt C++ 图形绘制完全指南:从基础到进阶实战
开发语言·c++·qt
楼田莉子1 小时前
python小项目——学生管理系统
开发语言·python·学习
亭台烟雨中1 小时前
SQL优化简单思路
数据库·sql