Ai
1 Star 0 Fork 0

lduml/qtBarCodeDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
barutil.h 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
lduml 提交于 2024-05-29 15:39 +08:00 . init
#ifndef BARUTIL_H
#define BARUTIL_H
#include <QObject>
#include <QGroupBox>
#include <QPaintEvent>
#include <QPainter>
#include <QPixmap>
#include "barcode.h"
#define LR_MARGIN_CODE128B 16 //code128B条形码左右留白宽度
#define LR_MARGIN_EAN13 2 //EAN13条形码左右留白宽度
#define TB_MARGIN_CODE128B 16 //code128B条形码上下留白宽度
#define TB_MARGIN_EAN13 22 //code128B条形码上下留白宽度
#define PEN_WIDTH 3 //画笔宽度 像素数
class BarUtil : public QObject
{
Q_OBJECT
public:
explicit BarUtil(QObject *parent = nullptr);
bool setBarCode(QString barCodeSrc,BarCode::BarCodeType barCodeType, int setBarCodeHeight);//设置条码
QPixmap paintBar(bool drawNumber);
void savePicture();//保存图片
private:
void drawBarCode(QPainter &painter,int x,int y, bool drawNumber=false);
BarCode barCode;//负责条形码编码
BarCode::BarCodeType barCodeType;//条码类型
QString barCodeSrc;//存放条码原数据
QString barCodeEncoded;//存放将条形码编码后的bs/01代码
QPixmap pixmap;//保存条形码图片
int barCodeWidth;//存储生成的条码宽度
int barCodeHeight;//条码高度
};
#endif // BARUTIL_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lduml/qtBarCodeDemo.git
git@gitee.com:lduml/qtBarCodeDemo.git
lduml
qtBarCodeDemo
qtBarCodeDemo
master

搜索帮助