101 lines
2.5 KiB
C++
101 lines
2.5 KiB
C++
#ifndef QBARCODE_H
|
|
#define QBARCODE_H
|
|
|
|
#include <QDialog>
|
|
|
|
#include "BarCode/barcode.h"
|
|
#include "QGraphicsScene"
|
|
#include "QGraphicsPixmapItem"
|
|
#include "SysPara.h"
|
|
#include "QTextEdit"
|
|
#include "ParaSettingUI.h"
|
|
|
|
//typedef struct // BarCodeOption
|
|
//{
|
|
// unsigned char xpos;
|
|
// unsigned char font;
|
|
// unsigned char height;
|
|
// unsigned char scale;
|
|
// unsigned char text[200];
|
|
//}bcOption_t;
|
|
typedef struct {
|
|
unsigned int width;
|
|
unsigned char height;
|
|
unsigned char type;
|
|
unsigned char nc;
|
|
}bcPara_t;
|
|
|
|
namespace Ui {
|
|
class QBarCode;
|
|
}
|
|
|
|
class QBarCode : public QDialog, public ParaSettingUI
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit QBarCode(QWidget *parent = 0);
|
|
~QBarCode();
|
|
void bindSysPara(SysPara *sysPara);
|
|
//unsigned char pointMap[40*1000];
|
|
QString pictureName;//当前显示的图片
|
|
void SetOption(bcOption_t *bcOption);
|
|
void GetOption(bcOption_t *bcOption);
|
|
QString bcText;
|
|
int bcWidth,bcHeight;
|
|
unsigned char flagInsert:1;
|
|
unsigned char flagCount:1;
|
|
unsigned char inkColor:1;
|
|
unsigned char flagNC:5;
|
|
|
|
int ImgRightPos(QImage *img);
|
|
int ImgLeftPos(QImage *img);
|
|
int getDat(unsigned char *dat,int varNum);
|
|
int getDat2(SysPara* sysPara,int varNum);
|
|
public:
|
|
QImage imgBar;
|
|
|
|
QString TextToBCImg(bcOption_t *bcVar,QString txt);
|
|
void TextBarCode(QString txt, int index);
|
|
void GetOption2(bcPara_t *bcOption);
|
|
QString getLabe_TxtString();
|
|
QString getVarTxt(bool varEn, unsigned varType);// 0,1,2,3,4
|
|
void extSetText(QString text);
|
|
public slots:
|
|
void setFontSize(int PixelSize);
|
|
private slots:
|
|
void onEnCodeBar();
|
|
void onScaleChange(int n);
|
|
void onXposChange(int n);
|
|
void on_pushBtnColse_pressed();
|
|
void ImgSave();
|
|
void onBarCodeRefresh(QString s);
|
|
signals:
|
|
void onBarCodeClose();
|
|
private:
|
|
|
|
void OnCharRamData(QImage *img);
|
|
void OnCharRamData1(QImage *img);
|
|
void OnCharRamData2(QImage *img1,int Txtwidth,int height);
|
|
void ShowBarCode(QString fileName);
|
|
void ShowBarCode(QImage *img);
|
|
int Barcode_Encode_and_Print(char *text, FILE *f, int wid, int hei,
|
|
int xoff, int yoff, int flags);
|
|
int Barcode_ToImage(Barcode_Item * bc );
|
|
int fontSize;
|
|
|
|
QGraphicsScene *scene;//声明scene
|
|
QGraphicsPixmapItem *item;//声明item
|
|
bool bcOK;
|
|
QString bcPartial;
|
|
QString bcTextinfo;
|
|
bool AutoRefresh;
|
|
QTextEdit textEdit;
|
|
QString txtVar1,txtVar2;
|
|
|
|
private:
|
|
Ui::QBarCode *ui;
|
|
};
|
|
|
|
#endif // QBARCODE_H
|