当前位置: 首页 > news >正文

Qt(9.28)

widget.cpp

#include "widget.h"Widget::Widget(QWidget *parent): QWidget(parent)
{QPushButton *btn1 =new QPushButton("登录",this);this->setFixedSize(640,480);btn1->resize(80,40);btn1->move(200,300);btn1->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\中国结\\picture"));btn1->setStyleSheet("color :white; background-color:skyblue;border-radius:10px");QPushButton *btn2 =new QPushButton("取消",this);btn2->resize(btn1->size());btn2->move(btn1->x()+btn1->width()+50,btn1->y());btn2->setIcon(QIcon("C:\\Users\\Administrator\\Desktop\\中国结\\picture"));btn2->setStyleSheet("color :white; background-color:skyblue;border-radius:10px");QLineEdit *edit1=new QLineEdit(this);edit1->resize(300,30);edit1->move(180,220);edit1->setStyleSheet("color :black;");edit1->setAlignment(Qt::AlignCenter);edit1->setEchoMode(QLineEdit::Password);edit1->setPlaceholderText("输入QQ密码");QLineEdit *edit2=new QLineEdit(this);edit2->resize(300,30);edit2->move(edit1->x(),edit1->y()-edit1->height()-10);edit2->setStyleSheet("color :black;");edit2->setAlignment(Qt::AlignCenter);edit2->setPlaceholderText("输入QQ账号");QLabel *lab1 = new QLabel;lab1->setParent(this);lab1->setText("密码:");lab1->move(edit1->x()-40, edit1->y()+10);QLabel *lab2 = new QLabel;lab2->setParent(this);lab2->setText("账号:");lab2->move(edit1->x()-40, edit1->y()-30);}Widget::~Widget()
{
}

main.cpp

#include "widget.h"#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);Widget w;w.show();return a.exec();
}

 widget.h

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
#include<QPushButton>
#include<QLineEdit>
#include<QLabel>
class Widget : public QWidget
{Q_OBJECTpublic:Widget(QWidget *parent = nullptr);~Widget();
};
#endif // WIDGET_H

 

 

http://www.lryc.cn/news/448683.html

相关文章:

  • javascript-冒泡排序
  • 第九届蓝桥杯嵌入式省赛程序设计题解析(基于HAL库)
  • MATLAB云计算集成:在云端扩展计算能力
  • 基于BeagleBone Black的网页LED控制功能(flask+gpiod)
  • 【C语言】单片机map表详细解析
  • Java中的继承和实现
  • uniapp云打包
  • 端口安全技术原理与应用
  • 数据集-目标检测系列-鲨鱼检测数据集 shark >> DataBall
  • 数字乡村解决方案-3
  • WPF文本框无法输入小数点
  • R开头的后缀:RE
  • Vue2配置环境变量的注意事项
  • 机器学习:探索未知边界,解锁智能潜力
  • 万户OA-ezOFFICE fileUpload.controller 任意文件上传漏洞复现
  • Time-MoE : 时间序列领域的亿级规模混合专家基础模型
  • Spring Boot入门指南
  • MYSQL(学习笔记)
  • 学校周赛(1)
  • 人生苦短,我用Python✌
  • uniapp js判断key是否在json中?
  • Codeforces Round 975 (Div. 2) C. Cards Partition
  • Qt 首次配置 Qt Creator 14.01 for Python
  • 【python】代码发布前检查- vulture:查找死代码
  • Yolov10环境配置
  • iOS 提取图片的主题色,并支持灵活提取
  • 语雀笔记使用记录
  • 安全教育培训小程序系统开发制作方案
  • 【面试题】软件测试实习(含答案)
  • 后端回写前端日期格式化