• 4671阅读
  • 5回复

Qt环境下,有没有支持Barcode的类? [复制链接]

上一主题 下一主题
离线vc2009
 
只看楼主 倒序阅读 楼主  发表于: 2009-07-27
好象有一个在KDE下KBarcode的东西,可以支持各种条形码和二维码的功能,不知道该怎么用?
我是在windows下VC2008+Qt 4.3,不知道该怎么做?
离线yj_yulin

只看该作者 1楼 发表于: 2009-07-27
慢慢研究,看看怎么样移植吧
离线yj_yulin

只看该作者 2楼 发表于: 2009-07-27
有个简单的方法如下(使用gnu的barcode命令行):

While KBarcode will work, it might be easier to simply use barcode and
ghostscript, each in a QProcess. For example:

QProcess *process1,*process2;
process1->addArgument("/usr/bin/barcode");
process1->addArgument("-b");
accountID = QString::number("123456");
process1->addArgument(accountID);
process1->addArgument("-o");
process1->addArgument("/tmp/barcode");
bstatus = process1->start();
qDebug("status of start process = %d",bstatus);
// delete process1;
QFile file(barcodeImageFile);
if (file.exists()) // remove old barcode if it exists
QFile::remove(barcodeImageFile);


// not sure if these are optimal ghostview parameters but they work
QProcess *proc2 = new QProcess(this);
proc2->addArgument("/usr/bin/gs");
proc2->addArgument("-sOutputFile="+ barcodeImageFile);
proc2->addArgument("-g100x50"); //widthxheight I think
proc2->addArgument("-sDEVICE=pnggray");
proc2->addArgument("-q");
proc2->addArgument("/tmp/barcode");
proc2->addArgument("-c");
proc2->addArgument("showpage");
proc2->addArgument("-c");
proc2->addArgument("quit");
proc2->start();

// ... load barcode into label
QLabel *barCode = new QLabel(this,"barcode");

  QPixmap pm("/tmp/barcode.jpg");
  barCode->setPixmap(pm);


This is essentially what kbarcode does.  It might be portable to Windows as I think someone has ported barcode to windows and ghostview is avaiilable on windows as well.


If you get a more elegant solution then this hack,  please post it to this group.
离线vc2009
只看该作者 3楼 发表于: 2009-07-27
还是不明白怎么可以在程序中和数据结合,在网上有一个EAN13的条码生成代码,试了一下,可以生成条码,也可以被别的软件识别。不知道,支持别的条码的有没有哪位高手做过?
离线sentimental
只看该作者 4楼 发表于: 2009-07-27
以前做过MFC的条码库  其实也不难 一种一种编码实现
离线vc2009
只看该作者 5楼 发表于: 2009-07-27
现做,肯定稳定性、适读性等应该会有很多问题的,现在,条码的应用应该很成熟了,不管是1D还是2D的,最好是有成熟的控件移植。Nokia手机有识别软件,不知被收购的Qt是否有条码的支持。
快速回复
限100 字节
 
上一个 下一个