压力算法移植前

This commit is contained in:
2026-06-29 14:54:30 +08:00
parent 507781d127
commit ef2eecf972
1652 changed files with 312373 additions and 29 deletions
+729
View File
@@ -0,0 +1,729 @@
#include "dlgQrCode.h"
#include "ui_dlgQrCode.h"
#include <stdio.h>
#include <stdlib.h>
#include <QImage>
#include <getopt.h>
#include <qdebug.h>
#include <QApplication>
#include "SysPara.h"
#include "InkJetPrinter.h"
#define AUTOREF true
#include "Matrix/dm200.h"
#define MDTFLAG 0xff00FF10
#define QRFLAG 0xff00FF20
#define BARFLAG 0xff00FF30
char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize);
char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize);
void Draw_MatrixToImg(unsigned char *buffer,QImage *pImg);
extern InkJetPrinter *pInkJectPrinter;
//void MatrixEnCode(unsigned char *intext,int Size);
static int casesensitive = 1;
static int eightbit = 0;
static int kanji = 0;
static int version = 0;
static int margin = 1;
static QRecLevel level = QR_ECLEVEL_L;
static int AutoCount=0;
static QImage img1;
static int InkColor=0;
static int QRCode_Level = 0;
dlgQrCode::dlgQrCode(QWidget *parent) :
QDialog(parent),
ui(new Ui::dlgQrCode)
{
ui->setupUi(this);
qrOption = new qrOption_t;
//ui->labQRImage->setText("");
ui->labName->setText("");
ui->labRECT->setText("");
bcWidth=bcHeight=0;
counter =0;
scene = new QGraphicsScene;
connect(ui->lineEditIn,SIGNAL(editingFinished()),this,SLOT(onTextChanged()));
connect(ui->checkBoxAuto,SIGNAL(clicked(bool)),this,SLOT(onQRCodeAuto(bool)));
// img1 =0;
connect(ui->comboBoxType, SIGNAL(currentIndexChanged(int)),this, SLOT(onComboBoxType(int)));
onComboBoxType(ui->comboBoxType->currentIndex());
sysPara = NULL;
#ifdef NETWORKQRCODE
// tcpserver 0506 hlp:四机赛瓦:tcp发送字符串生成二维码
m_tcpServer = NULL;
initTcpServer();
bool isNetQrCode = false;
#else
ui->btn_netQrCode->hide();
#endif
}
dlgQrCode::~dlgQrCode()
{
delete ui;
if(scene)
{
delete scene;
}
}
enum {
O_HELP,
O_OUTPUT,
O_SIZE,
O_VERSION,
O_LEVEL,
O_MARGIN,
O_KANJI,
O_CASE,
O_8BIT,
};
static const struct option options[] = {
{"h", no_argument , NULL, O_HELP},
{"o", required_argument, NULL, O_OUTPUT},
{"l", required_argument, NULL, O_LEVEL},
{"s", required_argument, NULL, O_SIZE},
{"v", required_argument, NULL, O_VERSION},
{"m", required_argument, NULL, O_MARGIN},
{"k", no_argument , NULL, O_KANJI},
{"c", no_argument , NULL, O_CASE},
{"8", no_argument , NULL, O_8BIT},
{NULL, 0, NULL, 0}
};
static QRcode *encode(const char *intext)
{
QRencodeMode hint;
QRcode *code;
if(kanji) {
hint = QR_MODE_KANJI;
} else {
hint = QR_MODE_8;
}
if(eightbit) {
code = QRcode_encodeString8bit(intext, version, QR_ECLEVEL_L);
} else {
code = QRcode_encodeString(intext, version, (QRecLevel)QRCode_Level, hint, casesensitive);
}
return code;
}
static void qrencode(const char *intext,int Size)
{
QRcode *qrcode;
//png_structp png_ptr;
//png_infop info_ptr;
unsigned char *row, *p, *q;
int x, y, xx, yy, bit;
int realwidth;
qrcode = encode(intext);
if(qrcode == NULL) {
fprintf(stderr, "Failed to encode the input data.\n");
exit(1);
}
realwidth = (qrcode->width + margin * 2) * Size;
row = (unsigned char *)malloc(realwidth);
// top margin
memset(row, 0x0, realwidth );
QImage QRImage(realwidth, InkColor?realwidth:qrcode->width*Size ,QImage::Format_ARGB32 );
QImage *img;
img = &QRImage;
if( AutoCount ) {
InkColor =0;
img->fill(0xff00ff00); // 0xff00ff01(DMT) 0xff00ff02(QR) 0xff00ff03(BAR)
}
else
img->fill(InkColor?0xff000000:0x00ffffff);
/* data */
p = qrcode->data;
int ypos=InkColor?margin:0;//margin * Size;
int xpos=0;
for(y=0; y<qrcode->width; y++) {
bit = 7;
bit = 7 - (margin * Size % 8);
xpos=margin * Size;
for(x=0; x<qrcode->width; x++) {
for(xx=0; xx<Size; xx++) {
if((*p & 1) << bit){
for(yy=0; yy<Size; yy++) {
img->setPixel(xpos,ypos+yy,InkColor? 0x00ffffff:0xff000000);
}
}
xpos++;
}
p++;
bit--;
if(bit < 0) {
//q++;
bit = 7;
}
}
ypos+=Size;
}
img1 = img->copy(img->rect());
if(AutoCount) img1.setPixel(0,ypos-1,QRFLAG);
free(row);
QRcode_free(qrcode);
}
void dlgQrCode::MatrixEnCode(unsigned char *intext,int Size)
{
U16 sColumns, sRows;
U08 *Grid;
sColumns = sRows = 0;
Grid = 0;
short sizeType = ui->comboBox_DMType->currentIndex();
Grid = iec16022ecc200((short*)&sColumns, (short*)&sRows, intext, &sizeType);
if(sizeType == -1)
{
QMessageBox::warning(0,tr("警告"),tr("输入内容超出选择DM码尺寸大小,请选择更大的尺寸!"));
return;
}
DataMatrixdDrawImg(Grid,sRows,sColumns,Size);
}
void dlgQrCode::on_pushBtnClose_pressed(){
flagInsert = ui->checkBox->checkState()?1:0;
AutoCount=(ui->checkBoxAutoCount->checkState())?1:0;
ui->checkBox->setChecked(0);
barCodeFlag = ui->barCodeCheckBox->checkState()?1:0;
on_pushBtnPreView_pressed();
emit onQRCodeCloseNow();
this->close();
}
char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize)
{
int Size=MSize;
int w = cColumns*Size;
int h = cRows*Size;
//qDebug()<<w<<h<<Size;
QImage QRImage(w+2,h,QImage::Format_ARGB32 );
QImage *img;
img = &QRImage;
img->fill( AutoCount?0xff00ff00:0x00ffffff);
/* data */
int margin=0;
U08 *p = OutBuff;
int ypos=0;//margin * Size;
int xpos=0;
int x,y,xx,yy,bit;
for(y=0; y<cRows; y++) {
bit = 7;
bit = 7 - (margin * Size % 8);
xpos=1;
xpos +=margin * Size;
for(x=0; x<cColumns; x++) {
for(xx=0; xx<Size; xx++) {
if((*p & 1) << bit){
for(yy=0; yy<Size; yy++) {
img->setPixel(xpos,h-1-(ypos+yy),AutoCount?0xff000000:0xff000000);
}
}
xpos++;
}
p++;
bit--;
if(bit < 0) {
//q++;
bit = 7;
}
}
// xpos++;
for(xx=0; xx<margin; xx++){
for(yy=0; yy<Size; yy++) {
img->setPixel(xpos,h-1-(ypos+yy),0x00ffffff);
}
xpos++;
}
ypos+=Size;
}
//img->save("Myqr.bmp");
img1 = img->copy(img->rect());
if(AutoCount) img1.setPixel(0,ypos-1,MDTFLAG); // 设置定位标志
return 0;
}
void dlgQrCode::on_pushBtnPreView_pressed(){
QString in;
InkColor = ui->comboBoxInkColor->currentIndex()?1:0;
AutoCount=(ui->checkBoxAutoCount->checkState())?1:0;
QString s1=ui->lineEditCNT->text();
QString s2;
int len = s1.length();
if(ui->checkBoxAutoCount->checkState()) {
in = ui->lineEditIn->text() + ui->lineEditCNT->text() +ui->lineEditIn2->text();// "%04d"
}
else in = ui->lineEditIn->text()+ui->lineEditIn2->text();
if(flagCount==0) in=ui->lineEditIn->text();
ui->lineEdit->setText(in);
if(in.isEmpty())
{
// qDebug()<<"QRcode string isEmpty";
return;
}QByteArray inUtf8 = in.toUtf8();
char *intext ="";
intext = (char *)malloc(inUtf8.length()*2);//intext = (char *)malloc(in.length()*2);
memset(intext,0,sizeof(intext));
memcpy(intext,inUtf8.data(),2*inUtf8.length());//memcpy(intext,in.toLocal8Bit().data(),2*in.length());
if(ui->comboBoxType->currentIndex()){ qrencode(intext,1); }
else { MatrixEnCode((unsigned char *)intext,1); }
//if(pInkJectPrinter->modbus->modbus_up_QRCODE == 0)
{
ShowQRCode(&img1);
}
bcWidth = img1.width();
bcHeight = img1.height();
ui->labRECT->setText(tr("[%1 X %2]").arg(img1.width()).arg(img1.height()));
if(!ui->checkBoxAutoCount->isChecked())
{
ui->pushBtnSave->setEnabled(true);
}
else
{
ui->pushBtnSave->setEnabled(false);
}
}
void dlgQrCode::onTextChanged(){
//qDebug()<<"onTextChanged:";
if(AutoRefresh){
emit on_pushBtnPreView_pressed();
}
}
void dlgQrCode::ShowQRCode(QImage *img)
{
scene->clear();
int scale = 4;
int bcWidth= img->width();
int bcHeight = img->height();
scene->setSceneRect( 0,0,bcWidth*(scale),bcHeight*(scale));
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
QPixmap pixmap(QPixmap::fromImage(*img));
pixmap = pixmap.scaledToHeight(bcHeight*(scale));
//pixmap = pixmap.scaledToWidth(scale*bcWidth);
item = scene->addPixmap(pixmap);
/***************设置view的场景*****************************/
ui->BarCodeView->setScene(scene);
ui->BarCodeView->setRenderHint(QPainter::Antialiasing);
ui->BarCodeView->setCacheMode(QGraphicsView::CacheBackground);
ui->BarCodeView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
ui->BarCodeView->setDragMode(QGraphicsView::ScrollHandDrag);
//ui->graphicsView->resize(400,300);
ui->BarCodeView->setScene(scene);//设置view的场景
}
#ifdef NETWORKQRCODE
void dlgQrCode::initTcpServer()
{
if (m_tcpServer == NULL) {
m_tcpServer = new TcpServer;
connect(m_tcpServer, SIGNAL(sig_dataReceived(quint64,QByteArray)),
this, SLOT(slt_handleMessage(quint64,QByteArray)));
}
}
void dlgQrCode::noticeInsert()
{
if (isNetQrCode) {
QMessageBox::StandardButton ret = QMessageBox::question(
this, tr("网络二维码"),
tr("启用网络二维码将清除当前编辑区中所有二维码(QR码、DM码、条形码),是否继续?"),
QMessageBox::Ok | QMessageBox::Cancel );
if (ret == QMessageBox::Ok) {
ui->lineEditIn->setText("NetworkQR");
ui->lineEditCNT->clear();
ui->lineEditIn2->clear();
// hlp 0506: 四机赛瓦:tcp发送字符串生成二维码; 启用外部通信
// tcp开启18080端口
if (m_tcpServer) m_tcpServer->start(18080);
emit sig_clearAllQRCode(); // 通知主窗口清除二维码
on_pushBtnClose_pressed();
} else {
ui->comboBoxType->setEnabled(true);//类型
if (m_tcpServer) m_tcpServer->stop();
}
} else {
emit sig_clearAllQRCode(); // 通知主窗口清除二维码
if (m_tcpServer) m_tcpServer->stop();
}
return;
}
#endif
void dlgQrCode::on_pushBtnSave_pressed(){
//if(img1.width()<10)
// on_pushBtnPreView_pressed();
QString s1 = ui->lineEditIn->text();
QString s2="";
int len =s1.length()<10?s1.length():10;
for(int i=1;i<len;i++)
{ QChar c=s1.at(i);
if( (c >='0' && c<='9') || (c>='A' && c<='Z') || (c>='a' && c<='z') )
s2+= QString(c);
}
s2 = (ui->comboBoxType->currentIndex()?"QR_":"DMT_")+s2.left(10)+".bmp";
if(AutoCount) s2 = (ui->comboBoxType->currentIndex()?"QRV":"DMTV")+ QString().sprintf("%02d",img1.height())+".bmp";
ui->labName->setText(s2);
if(pInkJectPrinter->modbus->modbus_up_QRCODE == 1)
{
// qDebug()<<"save modbusQR";
s2 = "modbusQR.bmp";
this->pictureName=DOC_ROOT_DIR+s2;
img1.save(pictureName);
pInkJectPrinter->modbus->modbus_up_QRCODE = 0;
}else
{
this->pictureName=DOC_ROOT_DIR+s2;
//如果是自动计数不作保存
if(AutoCount)
{
return;
}
img1.save(pictureName);
}
}
QString dlgQrCode::getCounterText( int counter,int QRCntNum){
QString s1="";
//counter = qrOption->counter;
char mFormat[20];
memset(mFormat,0,20);
if(QRCntNum>0) {snprintf(mFormat,20,"%%%02dd",QRCntNum);
if(QRCntNum==1) s1 = QString().asprintf(mFormat,counter%10);
else if(QRCntNum==2) s1 = QString().asprintf(mFormat,counter%100);
else if(QRCntNum==3) s1 = QString().asprintf(mFormat,counter%1000);
else if(QRCntNum==4) s1 = QString().asprintf(mFormat,counter%10000);
else if(QRCntNum==5) s1 = QString().asprintf(mFormat,counter%100000);
else if(QRCntNum==6) s1 = QString().asprintf(mFormat,counter%1000000);
else if(QRCntNum==7) s1 = QString().asprintf(mFormat,counter%10000000);
else if(QRCntNum==8) s1 = QString().asprintf(mFormat,counter%100000000);
else if(QRCntNum==9) s1 = QString().asprintf(mFormat,counter%1000000000);
else if(QRCntNum>=10) s1= QString().asprintf(mFormat,counter%10000000000);
//else s1 = QString().sprintf(mFormat,counter);
}
return s1;
}
void dlgQrCode::SetOption(qrOption_t *qrOption){
//memcpy( qrOption,qrOption0,sizeof(qrOption));
QString s1=qrOption->text2;
ui->checkBoxAuto->setChecked(qrOption->AutoRefresh);
ui->checkBox->setChecked(0);
ui->lineEditIn2->setText(s1);//后缀
ui->lineEditVarInc->setText(QString("%1").arg(qrOption->CntInc));
//qDebug()<<qrOption->CntInc;
s1=getCounterText(qrOption->counter,qrOption->cntNum);
ui->lineEditCNT->setText(s1);//变量
s1=qrOption->text;
ui->lineEditIn->setText(s1);//前缀
ui->comboBoxInkColor->setCurrentIndex(qrOption->InkColor);
ui->checkBoxAutoCount->setChecked(qrOption->AutoCount);//z//计数器变量
ui->checkBox->setChecked(flagInsert);
ui->barCodeCheckBox->setChecked(qrOption->barCodeFlag);
ui->comboBoxType->setCurrentIndex(qrOption->type);
QRCntNum = qrOption->cntNum;
if(qrOption->AutoCount) {
counter = qrOption->counter;
s1 = ui->lineEditIn->text()+ui->lineEditCNT->text()+ui->lineEditIn2->text();
}
else s1 = ui->lineEditIn->text()+ui->lineEditIn2->text();
ui->lineEdit->setText(s1);
if(s1.length()>10) s1 = "QR_"+s1.left(10)+".bmp";
if(AutoCount) s1 = (ui->comboBoxType->currentIndex()?"QRV":"DMTV")+ QString().sprintf("%02d",img1.height())+".bmp";
this->pictureName=DOC_ROOT_DIR+s1;
if(!qrOption->AutoRefresh) emit on_pushBtnPreView_pressed();
//AutoRefresh = AUTOREF;
ui->pushBtnSave->setEnabled(false);
if(sysPara)
{
sysPara->para.isCheckInsertTime ? ui->checkBoxInsertTime->setChecked(true) : ui->checkBoxInsertTime->setChecked(false);
}
}
void dlgQrCode::GetOption(qrOption_t *qrOption0){
//qrOption = qrOption0;
if(qrOption0){
qrOption0->width = img1.width();
qrOption0->height = img1.height();
//qrOption0->level = level; // ui->qrLevel->currentIndex()+1;
qrOption0->InkColor = ui->comboBoxInkColor->currentIndex()?1:0;
qrOption0->AutoRefresh = AutoRefresh;
qrOption0->type = ui->comboBoxType->currentIndex();
qrOption0->AutoCount=(ui->checkBoxAutoCount->checkState())?1:0;
snprintf(qrOption0->text,sizeof(qrOption0->text),"%s",ui->lineEditIn->text().toLatin1().constData());
snprintf(qrOption0->text2,sizeof(qrOption0->text2),"%s",ui->lineEditIn2->text().toLatin1().constData());
snprintf(qrOption0->textCnt,sizeof(qrOption0->textCnt),"%s",ui->lineEditCNT->text().toLatin1().constData());
qrOption0->cntNum =ui->lineEditCNT->text().length();
//qDebug()<<"GetOption cntNum"<<qrOption0->cntNum;
//bool ok;
qrOption0->counter = ui->lineEditCNT->text().toInt(0,10);
qrOption0->CntInc = ui->lineEditVarInc->text().toInt(0,10);
//qrOption->CntInc =11;
//qDebug()<<"TTTT"<<ok<<(qrOption->CntInc)<<(qrOption0->counter)<<(qrOption0->cntNum);
ui->pushBtnSave->setEnabled(false);
if(sysPara)
{
sysPara->para.isCheckInsertTime = ui->checkBoxInsertTime->isChecked() ? true : false;
}
}
}
int dlgQrCode::getDat(SysPara* sysPara,int varNum){
//TextToQRImg((QRvars_t *)&sysPara->print.QRvars[varNum]);
int w= img1.width();
int h= img1.height();
if(varNum>1)varNum=0;
int wStart=sysPara->print.QRvars[varNum].startColPos;
int hStart= sysPara->print.QRvars[varNum].startRowPos;
//if(hStart)hStart-=1;
//qDebug()<<"wStart"<<wStart<<hStart<<w<<h<<sysPara->status.printDat;
for(int i = 0 ; i < w; i++)
{
unsigned char c=0,c1=0;
int j=0;
hStart= sysPara->print.QRvars[varNum].startRowPos;
c=sysPara->status.printDat[(wStart)*5+(hStart)/8];
for( j = 0; j < h; j++)
{
QRgb rgb = img1.pixel(i,j);
if((rgb == 0xff000000)) c |= (1 << (hStart%8));
else c &= ~(1 << (hStart%8));
if(hStart%8==7) {
sysPara->status.printDat[(wStart)*5+(hStart)/8]=c;
c=sysPara->status.printDat[(wStart)*5+(hStart+1)/8];
}
hStart++;
}
sysPara->status.printDat[(wStart)*5+(hStart)/8]=c;
wStart++;
if(sysPara->status.addSpace ) wStart++; //&& sysPara->print.QRvars[varNum].type==0
}
return w;
}
#include "QDateTime"
void dlgQrCode::extSetText(QString text, bool flag)
{
if(flag)
{
ui->comboBoxType->setCurrentIndex(1);
}
else{
ui->comboBoxType->setCurrentIndex(0);
}
ui->lineEditIn->setText(text);
ui->lineEditIn2->setText("");
ui->lineEditCNT->setText("");
pInkJectPrinter->modbus->modbus_up_QRCODE =1;
emit on_pushBtnPreView_pressed();
emit on_pushBtnSave_pressed();
}
QString dlgQrCode::TextToQRImg(qrOption_t *qrVar){
QString in,s1,s2,s3;
//snprintf(qrVar->text,sizeof(qrVar->text),"%s",ui->lineEditIn->text().toLatin1().constData());
s1 = qrVar->text;//ui->lineEditIn->text();
s2 = qrVar->text2;
s3 = getCounterText(qrVar->counter,qrVar->cntNum) ;
QRCntNum = qrVar->cntNum;
in = s1+s2;
if(QRCntNum>0) {
in =s1+s3+s2;
}
// if(qrVar->TimeEn)
// in += " "+ QDateTime::currentDateTime().toString(tr("yy-MM-dd HH:mm:SS"));
counter = qrVar->counter;
if(in.isEmpty())in = "";
#ifdef MYARMTEST
//qDebug()<<"txtToImg:"<<in;
#endif
char *intext ="";
intext = (char *)malloc(in.length()*2);
memset(intext,0,sizeof(intext));
memcpy(intext,in.toLocal8Bit().data(),2*in.length());
if(qrVar->type){ qrencode(intext,1); }
else { MatrixEnCode((unsigned char *)intext,1); }
//ShowQRCode(&img1);
free(intext);
qrVar->width = img1.width();
qrVar->height = img1.height();
//qrVar->startRowPos = qrVar->endRowPos-qrVar->height;
bcWidth = img1.width();
bcHeight = img1.height();
return in;// 返回文件名
}
void dlgQrCode::onQRCodeAuto(bool En){
AutoRefresh = En;
//ui->pushBtnPreView->setEnabled(!En);
}
void dlgQrCode::onComboBoxType(int type)
{
if(type == 0)
{
ui->comboBox_DMType->setEnabled(true);
ui->comboBox_QRCodeLevel->setEnabled(false);
}
else
{
ui->comboBox_DMType->setEnabled(false);
ui->comboBox_QRCodeLevel->setEnabled(true);
}
}
void dlgQrCode::setCntCheckBoxHide(bool hideEn){
if(hideEn){
ui->checkBoxAutoCount->setChecked(0);
ui->checkBoxAutoCount->hide();
flagCount = 0;
ui->lineEditCNT->hide();
ui->labelVarInc->hide();
ui->lineEditVarInc->hide();
ui->lineEditIn2->hide();
ui->label_4->hide();
ui->label_3->hide();
}
else {
ui->checkBoxAutoCount->show();
ui->lineEditCNT->show();
ui->labelVarInc->show();
ui->lineEditIn2->show();
ui->label_4->show();
ui->lineEditVarInc->show();
ui->label_3->show();
flagCount =1;
}
}
void dlgQrCode::setSysPara(SysPara * sysPara)
{
this->sysPara = sysPara;
}
void dlgQrCode::on_comboBox_QRCodeLevel_currentIndexChanged(int index)
{
QRCode_Level = ui->comboBox_QRCodeLevel->currentIndex();
}
#ifdef NETWORKQRCODE
void dlgQrCode::on_btn_netQrCode_clicked()
{
if (ui->btn_netQrCode->text() == tr("插入网络二维码")) {
ui->btn_netQrCode->setText(tr("取消网络二维码"));
isNetQrCode = true;
} else {
ui->btn_netQrCode->setText(tr("插入网络二维码"));
isNetQrCode = false;
}
QString name = isNetQrCode? "networkQR.bmp" : "";
ui->labName->setText(name);
// 使用外部通信,即认为是通过tcp更新,不可勾选自动刷新和计数器,条形码等功能
ui->checkBoxAuto->setEnabled(!isNetQrCode); //自动更新
ui->checkBoxAutoCount->setEnabled(!isNetQrCode);// 自动计数
ui->barCodeCheckBox->setEnabled(!isNetQrCode);//条形码
ui->comboBoxType->setEnabled(!isNetQrCode);//类型:只能使用QR 二维码
ui->checkBoxInsertTime->setEnabled(!isNetQrCode);
ui->checkBoxAuto->setChecked(false);
ui->checkBoxAutoCount->setChecked(false);
ui->barCodeCheckBox->setChecked(false);
ui->comboBoxType->setCurrentIndex(1);
ui->checkBoxInsertTime->setChecked(false);
noticeInsert();
}
void dlgQrCode::slt_handleMessage(quint64 socketId, const QByteArray &data)
{
Q_UNUSED(socketId)
if (!isNetQrCode) return;
QString dataStr = QString::fromUtf8(data);
// 1. 更新界面输入框
ui->lineEditIn->setText(dataStr);
ui->lineEditCNT->setText("");
ui->lineEditIn2->setText("");
ui->checkBox->setChecked(true);
flagInsert = 1;
// 2. 生成新的二维码
char *intext = (char *)malloc(data.size() + 1);
memcpy(intext, data.data(), data.size());
intext[data.size()] = '\0'; // 结束符
qrencode(intext, 1); // 生成到 img1
free(intext);
// 3. 保存文件
QString fileName = "networkQR.bmp";
this->pictureName = DOC_ROOT_DIR + fileName;
img1.save(pictureName);
// 5. 显示新的二维码到界面
ShowQRCode(&img1);
bcWidth = img1.width();
bcHeight = img1.height();
ui->labRECT->setText(tr("[%1 X %2]").arg(img1.width()).arg(img1.height()));
emit sig_updateNetworkQR();
}
#endif