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()
{
}
相关推荐
molong93130 分钟前
Kotlin 内联函数、高阶函数、扩展函数
android·开发语言·kotlin
2401_8370885036 分钟前
什么是NoSQL?
数据库·nosql
盼哥PyAI实验室40 分钟前
踏上编程征程,与 Python 共舞
开发语言·python
阿无,1 小时前
Java设计模式之工厂模式
java·开发语言·设计模式
weixin_307779131 小时前
使用Python高效读取ZIP压缩文件中的UTF-8 JSON数据到Pandas和PySpark DataFrame
开发语言·python·算法·自动化·json
web安全工具库1 小时前
从课堂笔记到实践:深入理解Linux C函数库的奥秘
java·数据库·算法
ss2732 小时前
手写MyBatis第104弹:SqlSession从工厂构建到执行器选择的深度剖析
java·开发语言·后端·mybatis
kyle~2 小时前
Qt---setAttribute设置控件或窗口的内部属性
服务器·前端·c++·qt
周杰伦_Jay2 小时前
【Java集合体系】全面解析:架构、原理与实战选型
java·开发语言·数据结构·链表·架构
Camel卡蒙2 小时前
DDD架构——实体、聚合、值对象
java·开发语言·架构