Qt4 中的 USB 条形码阅读器
我想知道如何将 USB 条码扫描仪以及条码打印机集成到 Qt 应用程序中。
我寻找教程,但没有发现任何有趣的东西。有什么想法吗?
提前致谢。
I was wondering how could I integrate a USB barcode scanner into a Qt application, as well as a barcode printer.
I looked for tutorials but didn't find anything interesting out there. Any ideas?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从应用程序的角度来看,大多数条码扫描仪 IIRC 基本上像键盘一样工作。您只需提供一个文本字段,条形码阅读器就会“输入”它所读取的内容。因此,您实际上不需要担心这一点,除了验证输入,如果您不希望显示输入,还可以提供隐藏的文本字段。
或者一个模式对话框,显示“扫描项目”,焦点位于隐藏的文本区域。
就条形码打印机而言,如果您知道输出的标准,则可以很好地创建 SVG 或 PDF 并导出以进行打印。这样您的应用程序就可以处理打印尺寸等。
你没有说你使用什么语言,所以我找不到你的条形码书写库。
Most barcode scanners, IIRC basically work like a keyboard from the point of view of your application. You just provide a text field and the barcode reader "types" what it reads. So you don't really need to worry about that, other than validating the input and maybe providing a hidden text field if you don't want the input shown.
Or a modal dialog saying "scan item" with focus on a hidden text area.
In terms of a barcode printer, if you know the standard to which you are outputting, you would do well creating an SVG or PDF and exporting to print. This way your app can handle print dimensions and so on.
You don't say what language you are using, so I can't find you a barcode writing library.
这实际上不是一个 Qt 问题。
大多数扫描仪的行为类似于 USB 键盘,只需输入数字,就像您键入它们一样,否则它们将附带一个库,您可以像使用其他扫描仪一样使用它。
It's not really a Qt question.
Most scanners behave like aUSB keypad and just enter numbers as if you had typed them, otheriwse they will come with a library that you would use like any other.
这看起来像是一个依赖于 USB 条形码扫描仪功能的答案。
根据我的经验,涉及 USB 条形码扫描仪,它只是扫描条形码并将其发送到应用程序,就像模拟条形码中每个数字的击键一样。我不需要 API 库,我只需在文本框中输入一个输入,等待下一次扫描。
您应该检查一下是否是这种情况。或者可能有一个专门的 API 库来与扫描仪交互。
我确实使用了 OPOS 工具包,它有一系列用于 .NET 代码的垫片或薄包装器,它直到我发现 Microsoft 有一个集成的 POS sdk 库,用于.NET 框架此处和此处。
希望这有帮助,
此致,
汤姆.
This looks like an answer that is dependant on the functionality of the USB barcode scanner.
In my experience, which involved a USB barcode scanner, it simply scanned the barcode and sent it to the application as if the keystrokes for each digit in the barcode was simulated. I didn't need to have an API library, I just place an input on the textbox awaiting for the next scan.
You should check and see if that is the case. Or there could be a specialized API library to interact with the scanner.
I did use the OPOS toolkit which had a series of shims or thin wrappers for the .NET code, it was until I discovered that Microsoft had an integrated POS sdk libraries for the .NET framework here and here.
Hope this helps,
Best regards,
Tom.